text:
Q: Best way to write email addresses on webpages I've seen many websites (especially websites developed/designed by NIC - India) which write emails in following form -

mail[at]example[dot]com

But I personally like writing it this way (preferably in mailto: anchor tag) -

mail@example.com

Keeping in mind the reputation of NIC,

*

*Does first form of writing has any advantages? Or it's just some old age tradition?

*Which one is better considering accessibility of websites (ie screen readers etc)?

[Instead of subjective preferences, I would like to compare them on merits for sake of accessibility of websites]

A: Short Answer
mail[at]example[dot]com is an antiquated and inaccessible way of displaying email addresses in an attempt to stop web scrapers.
It makes things harder to use for everybody and nowadays is very unlikely to offer any protection so use a normal email address if you must (or better yet a contact form if spam bothers you, although I could write a whole book on how it is difficult to stop spam.)

Long Answer
Does first form of writing has any advantages? Or it's just some old age tradition?
The first version was designed originally purely to stop web scrapers from gathering email addresses.
However nowadays most web scrapers are pretty smart and will know to look for that format so I think the benefits are minimal.
You might get 10% less spam with it but that is a pure guess / conjecture.
Which one is better considering accessibility of websites (ie screen readers etc)?
Lets look at how they are read out:
mail[at]example[dot]com
This will be read as "mail left bracket at right bracket example left bracket dot right bracket com".
As you can imagine this is not ideal!
Also bear in mind that an American speech synthesizer may say "period" instead of "dot" so you make it less accessible there as it is not a familiar way to say it (minor point but important)
Along the same lines if you ever try to internationalise the site it will be a lot harder as you would have to change [at] and [dot] for a language specific name for those items.
Finally people with cognitive disorders may not associate mail[at]example[dot]com with an email address and get confused as to how to contact the company.
mail@example.com
This will be read like a normal email address "mail at example dot com". All the problems I cited above disappear.
The best option
Obviously the best option is to not have email addresses and use a contact form, but that is from a spam protection perspective.
If you don't mind the extra spam lists you will end up on then use the second option. You should also make this a link that opens the users mail client e.g. mail@example.com
When using a mailto link there isn't much you can do to protect yourself from spam as web scrapers are just looking for an email pattern and will almost certainly be looking for mailto: as an indicator of an email address, hence why we might as well show the proper email address.
Making it a link also has the added benefit that when a screen reader user navigates a page by links they will find the email address (one of the ways screen reader users orientate themselves in a page is to iterate through all links).
Displaying as an actual email address also means that everybody can copy and paste the email address to their email client if for some reason you don't make it a link or the link doesn't open their email client (they may not have one for example).
I would imagine asking someone on a mobile phone to try and copy the link with [at] in it and format it correctly would result in mistakes, frustration etc. resulting in lower conversion rates.
But I really really want to show mail[at]example[dot]com and I don't care about making it hard for people
Then you could make the email address appear like this but get read correctly in a screen reader.
We can do this using visually hidden text or using aria-label. I have included both as an example below.

.visually-hidden {
    border: 0;
    padding: 0;
    margin: 0;
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px 1px 1px 1px); /* IE6, IE7 - a 0 height clip, off to the bottom right of the visible 1px box */
    clip: rect(1px, 1px, 1px, 1px); /*maybe deprecated but we need to support legacy browsers */
    clip-path: inset(50%); /*modern browsers, clip-path works inwards from each corner*/
    white-space: nowrap; /* added line to stop words getting smushed together (as they go onto seperate lines and some screen readers do not understand line feeds as a space */
}

Using Visually Hidden Text (more robust)

Will be read like a normal email address "mail@example.com" is what a screen reader sees

mail[at]@example[dot].com

Using aria-label (a lot easier)

We use aria-label to override the contents of the paragraph for screen readers, yet again "mail@example.com" is what a screen reader sees

mail[at]example[dot]com

A: From accessibility point of view both are similar. Try by yourself using Voice Over or some other screen reader and both will be read the same.
I guess the idea was to write email addresses as the first form to make spammers more difficult to harvest email addresses from web pages.


text:
Q: CKEditor - Use Bootstrap js/css + Custom css inside ckeditor preview I would like to use bootstrap js/css AND a custom css file in ckeditor preview.
So, for example, if I write this code in ckeditor source code view...

First column

Second column

... I should see in ckeditor preview two 50% width columns (one red and one green).
I've found out that you can add css files to ckeditor with contentsCss or addContentsCss config (see ckeditor documentation for explanation), but what about bootstrap js files? How can I add js files to ckeditor preview?
I already know that (in order to allow class/styles tags) I need to configure ACF. For now I just used a quick fix to disable ACF completely:
CKEDITOR.replace( 'editor1', {allowedContent: true} );

Context:
My admin and frontend themes are different (both bootstrap-based, but different) and I use "CKEditor classic editing" or "framed editing", which means the editor creates a temporary  element for itself.
Basically...It's the default/standard ckeditor implementation (version 4.4.7).
!!!!EDIT!!!!
My solution:
/*Javascript files appear to be NOT necessary (if your page is bootstrap-based)
CKEDITOR.scriptLoader.load(['https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js','https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js'] );
*/
CKEDITOR.config.contentsCss  = ['https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css','mycustom.css'];
CKEDITOR.replace('editor1', {allowedContent: true});

If you come up with a better solution, let me know.
 In the meantime, if you find this question useful please vote up to improve its visibility.

A: There's a contentPreview event which allows manipulation of preview HTML, like
CKEDITOR.replace( 'editor', {
    on: {
        contentPreview: function( evt ) {
            evt.data.dataValue = 'B';
        }
    }
} );

A: I think CKEditor Bootstrap Utils will help you. It allows you to include (attach) Bootstrap's styles to your CKEditor document (preview) area automatically due to this bundle has Bootstrap Include CSS/JS add-in inside it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to display search results with ajax in django project? I am working in a Django project where one of the functionalities will be that user could search a name (using a form), the view will search that name in database (after some transformation), and the results will be displayed below the form.
At the moment, It is necesary that the entire page loads every time a search is submitted. I am working in apply ajax to make this dynamic. The problem is that when I return the search result as a JsonResponse, I am not able to see the data in the success function of ajax.
Views.py
def indexView (request):
    form = FriendForm ()
    friends = Friend.objects.all ()
    return render (request, "index.html", {"form": form, "friends": friends})

def searchFriend(request):
    if request.method =="POST":
        form = FriendForm (request.POST)

        if form.is_valid():
            if request.is_ajax():
                name = form.cleaned_data['name']
                query = Friend.objects.filer(first_name__contains=name)

                print(query)
                return JsonResponse(list(query), safe=False)

            else:
                return JsonResponse(form.errors)

Main.js
$(document).ready(function() {
    $("#form1").submit(function() { // catch the form's submit event
    var search = $("#searchField").val();

        $.ajax({ // create an AJAX call...
            data: $(this).serialize(), // get the form data
            method: 'post',
            dataType: 'json',
            url: "search/ajax/friend/",
            success: function(data) { // on success..
                console.log(data)

            }
        });
        return false;
    });
});

A: Is your query getting printed in terminal ?
Friend.objects.filer use filter instead of filer
and use type: 'post' instead of  method: 'post',
and add  data: $(search).serialize(), instead of data: $(this).serialize(),


text:
Q: Service worker caching after domain transfer I have a client that created a site (let's say example.com) that was built with create-react-app and used service workers to cache the site.
This client has now transferred the domain (example.com) for the create-react-app to a Wordpress site. So, now example.com should display content for the Wordpress site instead of the create-react-app application.
However, users that have previously visited the create-react-app version of the site only see a blank page because the service worker is caching the create-react-app application and failing to load the main javascript file for the React application.
I understand how we can manually force a cache reload; however, most visitors won't know the steps required to unregister the service worker. They will probably just think the site isn't working because they see a blank white page.
Does anyone know how to correct this issue for previous visitors of example.com automatically without them having to manually unregister the service worker?


text:
Q: Volley Server error (Requires javascript?) Android Development When trying to run my code to register a user via POST methods on my remote hosted database I get a mix of 2 errors in my app. The first being:
Volley Server Error
and second being an extremely long mess that essentially sums up to:
This site requires javascript to work. Please enable javascript in your browser.

I'm largely confused because as far as I know I'm not using javascript in my code whatsoever. If anyone can help clear this up for me, I'd be eternally grateful. Here's the
register.php
<?php
require_once 'include/constants.php';
$con = mysqli_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);

$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];

$stmt = mysqli_prepare($con, "INSERT INTO users (name, email, password) VALUES (?, ?, ?)");
$stmt->bind_param("sss", $username, $email, md5($password));
$stmt->execute();

$stmt->close();

And my
Register.class
    package com.thinkgeist.stashbox;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.*;

import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by natha on 2016-03-10.
 */
public class Register extends AppCompatActivity implements View.OnClickListener {
    Button bRegister;
    EditText etUsername, etEmail, etPassword, etConfirm;
    PopupWindow popUp;
    LinearLayout mainLayout;

    public static final String KEY_USERNAME = "username";
    public static final String KEY_EMAIL = "email";
    public static final String KEY_PASSWORD = "password";
    public static final String REGISTER_URL = "http://sb.thinkgeist.com/register.php";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        popUp = new PopupWindow(this);
        mainLayout = new LinearLayout(this);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);

        etUsername = (EditText) findViewById(R.id.etUsername);
        etPassword = (EditText) findViewById(R.id.etPassword);
        etConfirm = (EditText) findViewById(R.id.etConfirm);
        etEmail = (EditText) findViewById(R.id.etEmail);
        bRegister = (Button) findViewById(R.id.bRegister);

        bRegister.setOnClickListener(this);
    }

    @Override
    public void onClick(View v){
        switch(v.getId()){
            case R.id.bRegister:
                // Responds to register button being clicked
                String username = etUsername.getText().toString();
                String email = etEmail.getText().toString();
                String password = etPassword.getText().toString();
                String passConfirm = etConfirm.getText().toString();

                if(password.length() == 0 || email.length() == 0 || username.length() == 0 || passConfirm.length() == 0){
                    Intent popUp = new Intent(this, Pop.class);
                    popUp.putExtra("error_message", "All fields must be filled in to register!");
                    startActivity(popUp);
                    break;
                }

                // Test if email is of proper format
                if(!email.contains("@")){
                    Intent popUp = new Intent(this, Pop.class);
                    popUp.putExtra("error_message", "Email is of wrong format!");
                    startActivity(popUp);
                    break;
                }

                // Test if password length is okay
                if(password.length() <= 5 || password.length() > 20){
                    Intent popUp = new Intent(this, Pop.class);
                    popUp.putExtra("error_message", "Password must be between 6-20 characters!");
                    startActivity(popUp);
                    break;
                }

                if(username.length() <= 5 || username.length() >= 20){
                    Intent popUp = new Intent(this, Pop.class);
                    popUp.putExtra("error_message", "Username must be between 6-20 characters!");
                    startActivity(popUp);
                    break;
                }
                if(!password.contentEquals(passConfirm)){
                    Intent popUp = new Intent(this, Pop.class);
                    popUp.putExtra("error_message", "Passwords do not match!");
                    startActivity(popUp);
                    break;
                }

                User registeredData = new User(username, email, password);
                Intent popUp = new Intent(this, Pop.class);
                registerNewUser(this, registeredData);
                popUp.putExtra("error_message", "Account sucessfully created!");
                //startActivity(popUp);
                break;

        }
    }

    public void registerNewUser(Context context, User toRegister){
        final String username = toRegister.username;
        final String password = toRegister.password;
        final String email = toRegister.email;

        StringRequest stringRequest = new StringRequest(Request.Method.POST, REGISTER_URL,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        Toast.makeText(Register.this,response,Toast.LENGTH_LONG).show();
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(Register.this,error.toString(),Toast.LENGTH_LONG).show();
                    }
                }){
            @Override
            protected Map<String,String> getParams(){
                Map<String,String> params = new HashMap<String, String>();
                params.put(KEY_USERNAME,username);
                params.put(KEY_PASSWORD,password);
                params.put(KEY_EMAIL, email);
                return params;
            }

        };

        RequestQueue requestQueue = Volley.newRequestQueue(this);
        requestQueue.add(stringRequest);
    }
}

Sorry for the long post, but I feel it would be almost redundant to ask a question without providing enough information to have a chance at solving it. Thanks for anyone who takes their time out to help!


text:
Q: Why am I losing my connection to my MongoDB after my GKE node gets preempted? I am running a Mongo, Express, Node, React app in a GKE cluster that is setup with a preemptible VM (to save money). I am using mongoose to connect to my MongoDB which is hosted on Mongo Cloud Atlas. Everything works find when the pod first starts. However, when my node gets preempted, I lose connection to my mongoDB instance. I then have to go in and manually scale the deployment down to 0 replicas and then scaled it back up and the connection to the mongoDB is restored. Below is the error I am getting and the code for my mongo connection. Is this just a intended effect of using a preemptible instance? Is there any way to deal with it like, automatically scale the deployment after a preemption? I was running a GKE autopilot cluster and had no problems but that was a little expensive for my purposes. Thanks
mongoose
    .connect(process.env.MONGODB_URL, {
        useNewUrlParser: true,
        useUnifiedTopology: true,
        useFindAndModify: false,
    })
    .then(() => console.log('mongoDB connected...'));

(node: 24) UnhandledPromiseRejectionWarning: Error: querySrv ECONNREFUSED _mongodb._tcp.clusterx.xxxxx.azure.mongodb.net at QueryReqWrap.onresolve (dns.js:203)

A: The VM preemption can be reproduced in Compute Engine -> Instance groups -> Restart/Replace VMS and then choose option: Replace. After the VM has been restarted, the containers will be recreated too but unfortunately with network issues as mentioned.
My solution was to add liveness and readiness probes to Kubernetes Pods/Deployment via /health URL which checks if MongoDB is available and returns status code 500 if not. Details on how to define liveness and readiness probes in Kubernetes are here. The Kubernetes will restart pods that are not alive. The pods created later won't have network issues.
yaml spec block in my project looks like this:
spec:
  containers:
  - env:
    - name: MONGO_URL
      value: "$MONGO_URL"
    - name: NODE_ENV
      value: "$NODE_ENV"
    image: gcr.io/$GCP_PROJECT/$APP_NAME:$APP_VERSION
    imagePullPolicy: IfNotPresent
    name: my-container
    # the readiness probe details
    readinessProbe:
      httpGet: # make an HTTP request
        port: 3200 # port to use
        path: /health # endpoint to hit
        scheme: HTTP # or HTTPS
      initialDelaySeconds: 5 # how long to wait before checking
      periodSeconds: 5 # how long to wait between checks
      successThreshold: 1 # how many successes to hit before accepting
      failureThreshold: 1 # how many failures to accept before failing
      timeoutSeconds: 3 # how long to wait for a response
    # the livenessProbe probe details
    livenessProbe:
      httpGet: # make an HTTP request
        port: 3200 # port to use
        path: /health # endpoint to hit
        scheme: HTTP # or HTTPS
      initialDelaySeconds: 15 # how long to wait before checking
      periodSeconds: 5 # how long to wait between checks
      successThreshold: 1 # how many successes to hit before accepting
      failureThreshold: 2 # how many failures to accept before failing
      timeoutSeconds: 3 # how long to wait for a response


text:
Q: Overriding Ctrl+Z behavior in matlab zoom mode I want my own Ctrl+Z handler called while in zoom mode rather than the default handler. I found this article on Undocumented Matlab and tried this:
function zoomIn_OnCallback(hObject, eventdata, handles)
  set(handles.image_handle, 'ButtonDownFcn', []);
  zoom on;
  [handles.mode_manager.WindowListenerHandles.Enabled] = deal(false);
  handles.theGui.WindowKeyPressFcn =  [];
  handles.theGui.KeyPressFcn = @theGui_KeyPressFcn;
end

The code executes, but doesn't override the Ctrl+Z behavior of zoom mode.
I thought I exactly followed the example code from Undocumented Matlab, but obviously something isn't right.


text:
Q: How to use an SVG to make a hole in a  (React Native) I have made an orange View

And I want to use an SVG to carve out a hole out of the view (I'm rendering the curve in blue with react-native-svg)

How can I "carve" a hole out of that View? Should I instead make the View an Svg?
If so, I like having the orange bar as a View instead of an Svg so it's borders don't stretch on different resolutions, it just becomes longer. Is there an Svg way of doing that responsivity  easily?


text:
Q: Performance tuning of Informatica mapping I have to tune the informatica mapping performance .Source and target is sql server table. Mapping contain SQ-unconnected lookup-exp-target. Source and target table is same.
 Lookup query is taking 7-8mins in database And as per the session log also lookup cache creation is taking time.
I can see in this , It is taking time while creating the lookup cache , but I am not able to get the exact issue.
Can you please suggest how tune this session log or lookup query
Below  is the session log :-
Severity    Timestamp   Node    Thread  Message Code    Message
INFO    1/2/2020 2:38:17 AM WRITER_1_*_1    WRT_8158

*****START LOAD SESSION*****

Load Start Time: Thu Jan 02 02:38:17 2020

Target tables:

     Dim_Cust_Ord

INFO    1/2/2020 2:38:17 AM WRITER_1_*_1    WRT_8005    Writer run started.
INFO    1/2/2020 2:38:17 AM READER_1_1_1    RR_4049 RR_4049 SQL Query issued to database : (Thu Jan 02 02:38:17 2020)
INFO    1/2/2020 2:38:17 AM READER_1_1_1    RR_4029 SQ Instance [SQ_Dim_Cust_Ord] User specified SQL Query [SELECT
DISTINCT Dim_Cust_Ord.Business_Unit,
Dim_Cust_Ord.PO_Num,
Dim_Cust_Ord.Account_Num
FROM
Dim_Cust_Ord Dim_Cust_Ord with(NOLOCK)
WHERE
(Dim_Cust_Ord.PO_IND IS NULL OR Dim_Cust_Ord.PO_IND='O')
AND Dim_Cust_Ord.Business_Unit IN ('C','W','R','U')]
INFO    1/2/2020 2:38:17 AM     WRITER_1_*_1    WRT_8270    Target connection group #1 consists of target(s) [Dim_Cust_Ord]
INFO    1/2/2020 2:38:17 AM WRITER_1_*_1    WRT_8003    Writer initialization complete.
INFO    1/2/2020 2:38:17 AM READER_1_1_1    BLKR_16007  Reader run started.
INFO    1/2/2020 2:38:19 AM READER_1_1_1    RR_4050 RR_4050 First row returned from database to reader : (Thu Jan 02 02:38:19 2020)
INFO    1/2/2020 2:38:19 AM LKPDP_1 TM_6660 Total Buffer Pool size is 609824 bytes and Block size is 65536 bytes.
INFO    1/2/2020 2:38:19 AM LKPDP_1:READER_1_1  DBG_21438   Reader: Source is [BIPAOSQL@SLM], user [informat]
INFO    1/2/2020 2:38:19 AM LKPDP_1:READER_1_1  BLKR_16007  Reader run started.
INFO    1/2/2020 2:38:19 AM LKPDP_1:READER_1_1  BLKR_16003  Initialization completed successfully.
INFO    1/2/2020 2:38:20 AM LKPDP_1:READER_1_1  RR_4049 RR_4049 SQL Query issued to database : (Thu Jan 02 02:38:20 2020)
INFO    1/2/2020 2:41:49 AM LKPDP_1:READER_1_1  RR_4050 RR_4050 First row returned from database to reader : (Thu Jan 02 02:41:49 2020)
INFO    1/2/2020 2:41:49 AM LKPDP_1:TRANSF_1_1  DBG_21079   DBG_21079 Creating Lookup Cache : (Thu Jan 02 02:41:49 2020)
INFO    1/2/2020 2:41:49 AM LKPDP_1:TRANSF_1_1  TT_11195    Warning: Unsorted input found when building the cache for the Lookup transformation [LKP_FACT_BOOK]. The current number of entries in the index cache is 2. For optimal performance, use sorted input.

INFO    1/2/2020 2:59:16 AM LKPDP_1:READER_1_1  BLKR_16008  Reader run completed.
INFO    1/2/2020 2:59:16 AM LKPDP_1:TRANSF_1_1  DBG_21641   LKP_FACT_BOOK: Index cache size = [178960000], Data cache size = [357916672]
INFO    1/2/2020 2:59:16 AM LKPDP_1:TRANSF_1_1  DBG_21297   Lookup cache row count : 30101473

INFO    1/2/2020 2:59:16 AM LKPDP_1:TRANSF_1_1  DBG_21294   DBG_21294 Lookup cache creation completed : (Thu Jan 02 02:59:16 2020)
INFO    1/2/2020 2:59:16 AM LKPDP_1:TRANSF_1_1  DBG_21682   Lookup table row count : 30101473
INFO    1/2/2020 2:59:16 AM LKPDP_1:TRANSF_1_1  DBG_21216   Finished transformations for Source Qualifier [LKP_FACT_BOOK{{DSQ}}]. Total errors [0]
INFO    1/2/2020 2:59:16 AM LKPDP_1:TRANSF_1_1  CMN_1671    Created new cache files testlokup_4_0_278W64.[dat/idx] in directory F:\Informatica\InfoCache for Lookup [LKP_FACT_BOOK].
INFO    1/2/2020 2:59:17 AM WRITER_1_*_1    WRT_8167    Start loading table [Dim_Cust_Ord] at: Thu Jan 02 02:59:16 2020
INFO    1/2/2020 2:59:36 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 02:59:35 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 10296      Applied: 10296      Rejected: 0          Affected: 25585

Severity    Timestamp   Node    Thread  Message Code    Message
INFO    1/2/2020 2:59:53 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 02:59:52 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 20592      Applied: 20592      Rejected: 0          Affected: 49811

INFO    1/2/2020 3:00:13 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:00:12 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 30888      Applied: 30888      Rejected: 0          Affected: 74052

INFO    1/2/2020 3:00:34 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:00:34 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 41184      Applied: 41184      Rejected: 0          Affected: 101520

INFO    1/2/2020 3:00:56 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:00:56 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 51480      Applied: 51480      Rejected: 0          Affected: 129791

INFO    1/2/2020 3:01:18 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:01:18 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 61776      Applied: 61776      Rejected: 0          Affected: 157788

INFO    1/2/2020 3:01:41 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:01:41 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 72072      Applied: 72072      Rejected: 0          Affected: 189511

INFO    1/2/2020 3:02:05 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:02:05 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 82368      Applied: 82368      Rejected: 0          Affected: 215331

INFO    1/2/2020 3:02:23 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:02:23 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 92664      Applied: 92664      Rejected: 0          Affected: 243820

INFO    1/2/2020 3:02:47 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:02:47 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 102960     Applied: 102960     Rejected: 0          Affected: 271753

INFO    1/2/2020 3:03:11 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:03:10 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 113256     Applied: 113256     Rejected: 0          Affected: 297470

INFO    1/2/2020 3:03:35 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:03:34 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 123552     Applied: 123552     Rejected: 0          Affected: 324556

INFO    1/2/2020 3:03:59 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:03:59 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 133848     Applied: 133848     Rejected: 0          Affected: 351867

INFO    1/2/2020 3:04:25 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:04:24 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 144144     Applied: 144144     Rejected: 0          Affected: 377844

INFO    1/2/2020 3:04:34 AM READER_1_1_1    BLKR_16008  Reader run completed.
INFO    1/2/2020 3:04:34 AM READER_1_1_1    BLKR_16019  Read [158430] rows, read [0] error rows for source table [Dim_Cust_Ord] instance name [Dim_Cust_Ord]
INFO    1/2/2020 3:04:39 AM TRANSF_1_1_1    DBG_21216   Finished transformations for Source Qualifier [SQ_Dim_Cust_Ord]. Total errors [0]
INFO    1/2/2020 3:04:43 AM WRITER_1_*_1    WRT_8161
TARGET BASED COMMIT POINT  Thu Jan 02 03:04:43 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 154440     Applied: 154440     Rejected: 0          Affected: 401641

INFO    1/2/2020 3:04:48 AM WRITER_1_*_1    WRT_8168    End loading table [Dim_Cust_Ord] at: Thu Jan 02 03:04:47 2020
INFO    1/2/2020 3:04:48 AM WRITER_1_*_1    WRT_8035    Load complete time: Thu Jan 02 03:04:47 2020

LOAD SUMMARY
============

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 158430     Applied: 158430     Rejected: 0          Affected: 412362

INFO    1/2/2020 3:04:48 AM WRITER_1_*_1    WRT_8141
Commit on end-of-data  Thu Jan 02 03:04:47 2020
===================================================

WRT_8036 Target: Dim_Cust_Ord (Instance Name: [Dim_Cust_Ord])
WRT_8041 Updated rows  - Requested: 158430     Applied: 158430     Rejected: 0          Affected: 412362

INFO    1/2/2020 3:04:48 AM MANAGER PETL_24031
***** RUN INFO FOR TGT LOAD ORDER GROUP [1], CONCURRENT SET [1] *****
Thread [READER_1_1_1] created for [the read stage] of partition point [SQ_Dim_Cust_Ord] has completed.
    Total Run Time = [1577.617025] secs
    Total Idle Time = [1574.481379] secs
    Busy Percentage = [0.198758]
Thread [TRANSF_1_1_1] created for [the transformation stage] of partition point [SQ_Dim_Cust_Ord] has completed.
    Total Run Time = [1579.801052] secs
    Total Idle Time = [1574.840183] secs
    Busy Percentage = [0.314019]
    Thread work time breakdown:
        EXP_DIM_CUST_ORD: 100.000000 percent
Thread [WRITER_1_*_1] created for [the write stage] of partition point [Dim_Cust_Ord] has completed.
    Total Run Time = [1531.502834] secs
    Total Idle Time = [1199.889383] secs
    Busy Percentage = [21.652813]

INFO    1/2/2020 3:04:48 AM WRITER_1_*_1    WRT_8043    *****END LOAD SESSION*****
INFO    1/2/2020 3:04:48 AM WRITER_1_*_1    WRT_8006    Writer run completed.

Lookup Query :-
SELECT
SUM(Fact_Book.Qty) as Qty,
Fact_Book.Num as Num,
Fact_Book.Sold_To as bookSTo,
(case when Fact_Book.bk_numbr = '50'
then 'C'
when Fact_Book.bk_numbr = '40'
then 'R'
when Fact_Book.bk_numbr = '98'
then 'U'
else 'W'
end ) as code
FROM
Fact_Book with(NOLOCK)
GROUP BY
Fact_Book.Num,
Fact_Book.bookSTo ,
(case when Fact_Book.bk_numbr = '50'
then 'C'
when Fact_Book.bk_numbr = '40'
then 'R'
when Fact_Book.bk_numbr = '98'
then 'U'
else 'W'
end )```

A: If the source and target is the same physical table and lookup uses the same database, you can take advantage of Pushdown Optimization - just enable it in session properties and set it to Full.
If that's not possible, try changing lookup to joiner, sort data on Source Qualifier appropriately and enable the Sorted input joiner property.
Let me know if there would be any issues - there are some more options available.

A: I see that your lookup is caching around 30 million records with a group by clause in the query with no sorted input. Lookup will group the data and process it only after caching the entire data set. That's the main reason for taking a lot of time. You can try sorting the columns used in group by in the same order either in SQ or by creating a sorter. If you do not see any improvement after that, pass the sorted data and then try removing the cache option from lookup , some times not caching your lookup works faster than caching it. Also, what is the order by generated by the integration service? have only few columns in order by or suppress it altogether with '--' at the end of query. Indexing the lookup condition columns in the same order will also help improving the performance.

A: Using such a lookup query is rarely a good idea. Performance-wise I would try the following two options:
1. source the LKP table and build a mapping to create the expected LKP cache contents as the target (either flat file or DB table).
2. Source the LKP Table, use some AGG and/or JNR to implement that logic, and then join this data stream with your actual source data using a Joiner transformation.
Using AGG and JNR performs best if you make sure that these transformation receive sorted input. The Sorter transformation is the best tool to ensure sorted input for all transformations in PowerCenter (DB sorts often sort strings according to their locale which makes them "wrongly sorted" from the PowerCenter perspective).


text:
Q: Help using an array in 'exclude' key of another array I want to exclude two items (using their IDs) from an array that's retrieving images attached to the post: the post's thumbnail (featured image) and an image attached via Advanced Custom Fields.
I'm getting the first one's ID using get_post_thumbnail_id() and this last one's ID using get_field_object('icon'), where 'icon' is the $selector of the custom field (essentially an image, that's being used as an icon). If you're not familiar with ACF's Documentation the relevant part about this is here.
I've scrapped everything irrelevant for demonstration purposes. This is what I have and where [I believe] my problem is at:
$var = get_children(array(
  'exclude' => array(
    get_post_thumbnail_id(),
    get_field_object('icon')['ID'])
));

I'm thinking the result of get_post_thumbnail_id is an integer, so it works perfectly, but the result of get_field_object['ID'] is a string and that's why it doesn't work. If I could use something like echo it would probably work.
I would love to understand where it's wrong and how to make this work, please.

A: The ACF function returns an array, so would this work?
$field_object = get_field_object('icon'); // add post id as 2nd param if needed
$var = get_children(
  array(
  'exclude' => array(
    get_post_thumbnail_id(),
    $field_object['value'] // the saved value of the field, type cast to int if needed
    )
  )
);

A: The problem is that you use wrong ACF function.
get_field_object returns the settings of a specific field. Each field contains many settings such as a label, name and type. This function can be used to load these settings as an array along with the field's value.
So get_field_object('icon')['ID']) doesn't return the ID of image attachment, but ID of that ACF field.
What you want to use is:
$var = get_children(array(
    'exclude' => array(
        get_post_thumbnail_id(),
        get_field('icon')
    )
));

If your field returns the ID of selected image, or
$image = get_field('icon');
$var = get_children(array(
    'exclude' => array(
        get_post_thumbnail_id(),
        $image['ID']
    )
));

if it returns an array.
More on get_field for Image field


text:
Q: what would be a good approach to store a dictionary of dataframes in MySQL? Now I have a dictionary, where each key is corresponding to a 3-row dataframe(same kind), what would be a good way of storing this data in MySQL?
I am using python, pandas.
Thanks for any help!
Edit:
Here is the format of each dataframe
  Col1 Col2
1 A  0.2
2 B  0.3
3 C  0.25

The purpose of the data is for searching. When we request by a key, I want to get all the information stored in its associated dataframe. Storing it in one table would be enough for future usage.

A: Consider the following approach:
Setup:
In [10]: df1
Out[10]:
  Col1  Col2
1    A  0.20
2    B  0.30
3    C  0.25

In [11]: df2
Out[11]:
  Col1   Col2
1    A  10.20
2    B  10.30
3    C  10.25

In [12]: df3
Out[12]:
  Col1   Col2
1    A  20.20
2    B  20.30
3    C  20.25

In [13]: dfs = {'df1':df1, 'df2':df2, 'df3':df3}

We can merge all of our DFs into one DF and add additional column containing the key:
In [15]: df = pd.concat([df.assign(idx=key) for key, df in dfs.items()], ignore_index=True)

In [16]: df
Out[16]:
  Col1   Col2  idx
0    A   0.20  df1
1    B   0.30  df1
2    C   0.25  df1
3    A  10.20  df2
4    B  10.30  df2
5    C  10.25  df2
6    A  20.20  df3
7    B  20.30  df3
8    C  20.25  df3

and save it to MySQL:
df.to_sql('table_name', engine, if_exists='...')

PS i would also consider adding an index based on the 'idx' column in order to speed up access/searching in MySQL...


text:
Q: given two state A and B of tower of hanoi, find out that is it possbile to reach from A to B moving optimally Given two state A and B,find out that is it possible to reach B from A moving optimally.
where each state says the current position of disks in respective pegs. Here the number of pegs are 3.
example
For N=3 disks and 3 pegs, the task is to move all the disk from peg 1 to 2 using peg 3
  peg(disk number)

state A - 1(4),  2(3,2,1), 3(blank)
explanation- peg one has disk no 4, peg 2 has disk no. 3,2,1 and peg 3 has disk no. 3
state B - 1(2,1), 2(blank), 3(4,3)
For the above case the answer is true, its possible to move.
My current approach
For given N(no of disk),generate all the set put it in map, with generation time. For a given states compare the generation time and answer.
Problem
For larger N=10^4 or more, its not feasible to generate all the set bcz total number of set is 2^N. I hope that a linear or logarithmic solution exist here.


text:
Q: .htaccess rewrite portion of URL I have two requirements:

*

*I want to rewrite component/testcomp in URL to just comp.

https://www.website.com/component/testcomp should look as:
https://www.website.com/comp in URL.

*All requests coming fo website.com should be 301 redirected to https://www.website.com
Below is the content of my .htaccess file:
   IndexIgnore *

Options +FollowSymlinks
Options -Indexes

RewriteEngine On

RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

RewriteBase /
RewriteCond %{HTTP_HOST} ^website\.com$ [NC]
RewriteRule ^(.*)$ https://www.website.com/$1 [R=301,L]

How can I do so? I tried adding Rewrite Rule but it is not working. Let me know the Rewrite rule & where should I place it.

A: To rewrite "/component/testcomp" to just "comp", I think you have to flag it with R, or use R=301 to make it a permanent. I have a feeling you may have to adjust additional rules, however.
RewriteRule ^component/testcomp/(.*)$ /comp/$1 [L,R]

or to make it permanent:
RewriteRule ^component/testcomp/(.*)$ /comp/$1 [L,R=301]

A: Try the following:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ /component/test(comp)(\S*) [NC]
RewriteRule ^ /%1 [R=301,L,QSA]

and then,
RewriteRule ^comp(.*)$ /component/testcomp$1 [QSA,NC,L]


text:
Q: How I can merge "changes" from two text files in one file, programmatically? Use case
The requirement is to merge CHANGES from two different files in one file.
This is not about JOINING two files end-to-end.
Consider files FILE_A, FILE_B & FILE_C, respectively:
FILE_A
FUNCTION FUNCTION1
STATEMENT STATEMENT11
STATEMENT STATEMENT12
;

FUNCTION FUNCTION2
STATEMENT STATEMENT21
STATEMENT STATEMENT22
;

FILE_B
FUNCTION FUNCTION1
    STATEMENT STATEMENT11   #this is comment1
    STATEMENT STATEMENT12
;

FUNCTION FUNCTION2
    STATEMENT STATEMENT21   #this is comment2
    STATEMENT STATEMENT22
;

FILE_C
FUNCTION FUNCTION1
STATEMENT STATEMENT11
STATEMENT STATEMENT12
;

FUNCTION FUNCTION2
STATEMENT STATEMENT21
STATEMENT STATEMENT22
STATEMENT STATEMENT23
;

The important thing to notice here is that FILE_A & FILE_C are system-generated while FILE_B includes indentation corrections and comments made by the user.
The problem is that every time this file is system generated, we are losing the indentations and comments made by the user.
Solution I propose:
After generating FILE_C, system should merge changes from FILE_B &  FILE_C into a new file, FILE_D which I call as superimposing files.
FILE_D
FUNCTION FUNCTION1
    STATEMENT STATEMENT11   #this is comment1
    STATEMENT STATEMENT12
;

FUNCTION FUNCTION2
    STATEMENT STATEMENT21   #this is comment2
    STATEMENT STATEMENT22
    STATEMENT STATEMENT23
;

But I am not sure how to achieve this programmitically!
Any suggestion on how to solve this problem is appreciated. I am trying to solve this problem in Scala though.

Edited 1
What alternative approach could I employ to preserve indentations and comments?
The system takes care of preserving other changes besides indentations and comments, made by the user, such as, functions and statements but not indentations and comments. How to achieve the same? Please suggest?
Please let me know if this is the right place for this question or this question needs to be expressed in a better way.

A: This is a known problem for generated configuration files. Trying to merge these files somehow is in my opinion the wrong approach, as it is also very error-prone. Even big applications like git do not merge multiple changes in one file (instead, you have to do it manually. It is called a merge conflict). Most approach this by adding the information #DO NOT EDIT THIS FILE - ANY CHANGES WILL BE OVERRIDEN to the generated configuration file. The user is then instead meant to copy the file to another directory and make changes there.
Directory Structure
config
|
` - generated
|   |
|   `application.conf # Generate your config to this file
|
|
` - changes
    |
    `application.conf # Read your config from this file. If it doesn't exist, read config/generated/application.conf instead


text:
Q: Property 'controls' does not exist on type 'AbstractControl'. Angular 7 I keep getting the same build error when I run ng build -aot
The build error says Property 'controls' does not exist on type 'AbstractControl'.
My Form looks like this
component.ts
And the HTML look like this
component.html

A: That's a lot of chaining!
FromGroup has an attribute of the form controls: { [key: string]: AbstractControl; }. This means that, in your HTML, when you write createUserForm.controls.password, the AOT compiler understands that it is an object of type AbstractControl - which, in turn, does not declare an attribute named controls!
Right now, there's no way for the compiler to understand that your password group is an actual FormGroup - all it understands is that it is an AbstractControl(which may be a control, a group or an array). In order to show the AOT compiler that password is, in fact, a group, you can declare a helper getter in your component file:
get passwordGroup(): FormGroup { return this.createUserForm.controls.password as FormGroup; }

and then you can go to your HTML file and properly find your subcontrols:
<app-validation-messages [control]="passwordGroup.controls.password" ></app-validation-messages>

All that said, I personally dislike the use of nested groups and controls like that. You could have instead made your app-validation-messages component implement the ControlValueAccessor interface as well as make it provide  the NG_VALUE_ACCESSOR token. Doing that, you can then control the value using the formGroupName and formControlName directives:
<div formGroupName="password">
  <app-validation-messages formControlName="password"></app-validation-messages>
</div>


text:
Q: Port forwarding ADSL I have a TP-LINK TD-8817 as my ADSL Router, and a TP-LINK TL-MR3420 as a WiFi Router.
I've opened port 80 as can be seen by this result from a port forwarding tester:

The problem is, whenever I access my public IP (125.xxx.xxx.xxx:80), it's still returning to my router port. I expected it to return to my computer's IP address and port, 192.168.0.102.

Client:
 IPv4 Address. . . . . . . . . . . : 192.168.0.102(Preferred)
 Subnet Mask . . . . . . . . . . . : 255.255.255.0
 Lease Obtained. . . . . . . . . . : 24 Juli 2013 15:34:29
 Lease Expires . . . . . . . . . . : 24 Juli 2013 21:34:06
 Default Gateway . . . . . . . . . : 192.168.0.1
 DHCP Server . . . . . . . . . . . : 192.168.0.1

My forwarded ports on the ADSL modem:
Rule     Application     Protocol    Start Port  End Port    Local IP Address
1            HTTP_Server    ALL         80          80         192.168.1.100
2            HTTP_Server    ALL         443         443        192.168.1.100

WiFi router:
   ID   Service Port    Internal Port   IP Address  Protocol    Status  Modify
1        80                 80        192.168.0.102     All          Enabled    Modify Delete

I have no idea how to resolve this. Any thoughts?

A: Your ADSL router already uses the TCP80 port for its remote administration interface.
From here you have 2 solutions :
1) Change Router interface port
If you can find any parameter in your router's configuration for this, change it to, for example, 8080.
After that your NAT should work fine.
2) Change your external HTTP port
If your router does not support the modification of its remote interface TCP port, you will have to choose another port for your website, which is often unwanted.
In your port forwarding settings, change this :
Rule     Application     Protocol    Start Port  End Port    Local IP Address
1            HTTP_Server    ALL         80          80         192.168.1.100

To this :
Rule     Application     Protocol    Start Port  End Port    Local IP Address
1            HTTP_Server    ALL       8080        8080         192.168.1.100

And this :
ID   Service Port    Internal Port   IP Address    Protocol
1       80              80        192.168.0.102     All

To this:
ID   Service Port    Internal Port   IP Address    Protocol
1     8080              80        192.168.0.102     All


text:
Q: Update a table based on joining 4 tables I have the following tables:
agent
+-------------------------------------+
| id  |  name   | desc     |  comment |
|-------------------------------------+
| 1   |  agent1 | agent 1  | sss      |
| 2   |  agent2 | agent 2  | eee      |
|-------------------------------------|

agent_old
+-------------------------------------+
| id  |  name   | desc     |  comment |
|-------------------------------------+
| 1   |  agent1 | agent 1  | sss      |
| 2   |  agent3 | agent 3  | eee      |
|-------------------------------------|

auth
+-------------------------------+
| id  |  login   | password     |
|-------------------------------+
| 1   |  agent1  | xxxxxxx      |
| 2   |  agent2  | yyyyyy       |
|-------------------------------|

auth_old
+-------------------------------+
| id  |  login     | password   |
|-------------------------------+
| 1   |  oldagent1 | wwwwww     |
| 2   |  oldagent2 | qqqqqq     |
|-------------------------------|

I need the resultant tables like this:
agent
+-------------------------------------+
| id  |  name   | desc     |  comment |
|-------------------------------------+
| 1   |  agent1 | agent 1  | sss      |
| 2   |  agent2 | agent 2  | eee      |
|-------------------------------------|

auth
+-------------------------------+
| id  |  login   | password     |
|-------------------------------+
| 1   |oldagent1 | wwwwww       |
| 2   |  agent2  | yyyyyy       |
|-------------------------------|

This is what I have got but does not run:
update auth a
set
    a.login = oa.login,
    a.password = oa.password
from (
    select o.login,
    o.password
    from auth_old o
    join agent na
    join agent_old ago
    on ago.id = o.id
    and na.name = ago.name
    and na.desc = ago.desc
    ) oa
where a.id = na.id

A: In mysql you could use  this sintax  but you have not an id in you from ( select ) oa ..  i have added  the o.id for this  (hope is the right one)
    update auth a
    inner join  (
        select o.login,
        o.password ,
        na.id
        from auth_old o
        join agent na
        join agent_old ago
        on ago.id = o.id
        and na.name = ago.name
        and na.desc = ago.desc
        ) oa  on a.id = oa.id
    set
        a.login = oa.login,
        a.password = oa.password

(and as suggested  by Bill Karvin you have a wrong table alias na instead of oa)


text:
Q: Manage scaling of Statefulsets using Kubernetes API
*

*I want scale up my statefulset and want to initiate this scale up from inside the pod(container) using
the Kubernetes API(http request) to the kubernetes rest server.

*I tried scaling up statefulset pods using

PUT /apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/scale

*

*but it didn't work for me.

Even tried fetching the scale data of specified statefulset using

"GET /apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/scale"

REQUEST : curl -s -k -H "Authorization: Bearer $TOKEN" -X GET https://kubernetes.default.svc:443/apis/apps/v1/namespaces/$Namespace/$Kind/$PodNamePrefix/scale

Gives an error :

*

*"message": "statefulsets.apps "app-4x" is forbidden: User
"system:serviceaccount::default" cannot get resource
"statefulsets/scale" in API group "apps" in the namespace
""","reason": "Forbidden",

*Reference : https://v1-14.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.14/
Can somebody help me with this?

A: You need to define RBAC using Role and RoleBinding to authorize the service account to perform the required operations
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  namespace: default
  name: ss-role
rules:
- apiGroups: ["apps"]
  resources: ["statefulsets/scale" ]
  verbs: ["get", "list", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  namespace: default
  name: ss-rolebinding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: ss-role
subjects:
- kind: ServiceAccount
  name: default
  namespace: default

Above Role and RoleBinding is based on the assumption that you are using default service account of default namespace to scale statefulsets in default namespace.


text:
Q: How can I include in the JSON's GET request the list of foreign keys of a model in Django? My models have users that can have multiple devices. When I do a GET request on users it returns only the fields specified in the user model, as it should. But I want the option to include in the JSON returned by the GET request the list of devices the user has. How can I do that? Secondly, is there a way I can sometimes get a user with the list of devices in the same JSON, and other times without it? Also, I am really new to Django, and I would appreciate a lot code examples to understand better, if possible.
These are my models:
class User(models.Model):
    name = models.CharField(max_length=100)
    birth_date = models.DateField()
    address = models.CharField(max_length=200)

class Device(models.Model):
    description = models.CharField(max_length=200)
    location = models.CharField(max_length=200)
    max_energy_consumption = models.FloatField()
    avg_energy_consuumption = models.FloatField()
    user = models.ForeignKey(User, on_delete=models.CASCADE, null=True)

My serializers:
class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = '__all__'

class DeviceSerializer(serializers.ModelSerializer):
    class Meta:
        model = Device
        fields = '__all__'

And the following default ModelViewSets for CRUD api calls:
class UserViewSet(ModelViewSet):
    queryset = User.objects.all()
    serializer_class = UserSerializer

class DeviceViewSet(ModelViewSet):
    queryset = Device.objects.all()
    serializer_class = DeviceSerializer

A: There are some different ways easiest one would be add a property in your User model and add that to your serializer
class User(models.Model):
    name = models.CharField(max_length=100)
    birth_date = models.DateField()
    address = models.CharField(max_length=200)

    @property
    def devices(self):
        return Device.objects.filter(user_id=self.id).values("location", "description").distinct()

class UserSerializer(serializers.ModelSerializer):
    devices = serializers.ReadOnlyField()
    class Meta:
        model = User
        fields = '__all__'

EDIT - for second part of your question:
I have experienced that writing '__all__' in our serializers not the best thing to do when we do not need all the information all the time(performance issues). To address this obsticle making a seperate serializer would be again an easy solution. Whenever I am facing this kind of thing i query same endpoint but send a different qs that i dont use in other endpoint in your case lets say your user viewsets route is something like /api/user/ you can add a qs when you send your get request to your backend and add ?with_devices=true.
Then you can use your second user serializer like this:
class UserViewSet(ModelViewSet):
    queryset = User.objects.all()

    def get_serializer_class(self):
        if self.request.GET.get("with_devices", False):
            return UserWithDeviceSerializer
        return UserSerializer

where your serializers would be something like:
class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ["name", "birth_date", ..so on]

class UserWithDeviceSerializer(serializers.ModelSerializer):
    devices = serializers.ReadOnlyField()
    class Meta:
        model = User
        fields = '__all__'

This would give you what you asked in the comment.


text:
Q: How do I set a div width equal to a Javascript variable? I am trying to make a div expand as the user presses a button over and over again.

How can I set the width of the div equal to heartClicks?

A: document.getElementById('luv').style.width = heartClicks + "px";

A: document.getElementById("luv").style.width = heartClicks + "px";

Something to keep in mind is you're going to need to reset/reapply the style everytime they click so you might want to stick this in your button click function.

A: var heartClicksElement = document.querySelector("#luv");
heartClicks = heartClicksElement.style.width;

A: @aug's answer is great for standard javascript (make sure you have an event handler). If you want to use jQuery (or if anyone else browsing this question wants to use jQuery) try the following:
var heartClicks=10;

$(function(){
    $('#expand').on("click",function(){
        heartClicks++;
        $('#luv').css({'width':heartClicks});
    });
});

Try it out with this working fiddle.


text:
Q: Bcrypt is always false after the first login I am using bcrypt to hash the user password. The issue is that when I compare the plain text password with the hashed password, the result is true only on the first login. After the first login, I get "Unable to login".
User schema
const userSchema = new mongoose.Schema({
    firstName: {
        type: String,
    },
    lastName: {
        type: String,
     },
    email: {
        type: String,
        unique: true,
        required: true,
        // validate()
    },
    password: {
        type: String,
        required: true,
        minlength: 6,
        // validate()
    },
    tokens: [{
        token: {
            type: String,
            require: true
            }
        }]
})

// Defining my custom function "findByEmailAndPassword" so that I can use it directly on the model "User"
userSchema.statics.findByEmailAndPassword = async function(email, password){
    const user = await User.findOne({email})
    if(!user){
        throw new Error("Unable to login")
    }

    const isMatch = await bcrypt.compare(password, user.password)
    console.log("isMatch", isMatch) // It fails here. On the first login it works, but after the first I get "Unable to login" and the result of isMatch is always false
    if(!isMatch){
        throw new Error("Unable to login")
    }
    return user
}

// Hash the password with a middleware and bcrypt
userSchema.pre("save", async function(next) {
    // "this" refers to the user
    this.password = await bcrypt.hash(this.password , 8)
    next()
})

const User = mongoose.model("User", userSchema)

module.exports = User

User login router
router.post("/api/users/login", async (req, res) => {
    try {
        const user = await User.findByEmailAndPassword(req.body.email, req.body.password)
        const token = await user.generateAuthToken()
        res.send({
            user: user,
            token: token
        })
    } catch(e) {
        res.status(400).send("Unable to login")
    }
})


text:
Q: RuntimeException catching in request listener -> Twig error template I have a kernel listener bound to a kernel.request event, which can throw a PHP \RuntimeException in certain cases. Whereas in dev env Symfony catches the exception and shows me the Twig error page for 'Fatal error', in prod env I just keep getting an empty page. This is a 200 OK HTTP response, but it has no content.
What I'd like to achieve is showing a customised error page - i.e. 'Wrong application configuration', which will actually be of any use for the end user trying to reach the page. This is a fatal error, but - well - it can eventually happen.
I tried catching it in my exception listener which gets executed on kernel.exception event, but it seems not to be catching a 'fatal error' exception.
Here's what I've tried so far

*

*kernel.exception event listener

*throwing a 'normal' \Exception (thought that maybe that's the case). Seems that an exception thrown from within a listener does not fire the kernel.exception event as well...

Any suggestions?

A: OK, I seem to have found the answer.
The problem was the order of services' definitions. When you tag a service to bind one of its methods to a kernel.exception event, it needs to be - of course - declared in your services' config before you throw an exception in any other listener. Or any other place, as a matter of fact.


text:
Q: bad bind variable trigger for update and inserting I keep getting a bad bind variable error. I have tried debugging it but this is still lingering over, not too sure why it's saying this here.
What I'm trying to do as if someone is inserted into the enrols database BEFORE 1993 then they get a 10% discount for that paper. Also, if updating the details and they were enrolled before start of 1993, then give them a 10% discount.
errors:
6/31     PLS-00049: bad bind variable 'OLD.PAPER_COST'
6/50     PLS-00049: bad bind variable 'OLD.PAPER_COST'
14/31    PLS-00049: bad bind variable 'NEW.PAPER_COST'
14/50    PLS-00049: bad bind variable 'NEW.PAPER_COST'

Shouldn't this be okay, that I'm not referencing paper_cost in my enrols relation but in my papers relation as I'm calling "update papers" prior to paper_cost?
CREATE OR REPLACE TRIGGER discount_160
BEFORE INSERT OR UPDATE ON enrols
FOR EACH ROW
BEGIN
    IF UPDATING THEN
      IF (date_enrolled < TO_DATE('01-Jan-1993', 'dd-mon-yyyy')) THEN
         IF (paper_code = 160) THEN
            UPDATE papers
            SET paper_cost = (:OLD.paper_cost - (:OLD.paper_cost * 0.1))
            WHERE papers.paper_code = enrols.paper_code;
       END IF;
    END IF;
    ELSE --inserting
      IF (date_enrolled < TO_DATE('01-Jan-1993', 'dd-mon-yyyy')) THEN
         IF (paper_code = 160) THEN
            UPDATE papers
            SET paper_cost = (:NEW.paper_cost - (:NEW.paper_cost * 0.1))
            WHERE papers.paper_code = enrols.paper_code;
         END IF;
      END IF;
   END IF;
END;
/

My enrols relation:
CREATE TABLE enrols
       (paper_code         INT     ,
       student_id         INT      REFERENCES student(student_id),
       date_enrolled      DATE,
       dept_id            INT,
       PRIMARY KEY(paper_code, student_id, dept_id),
       FOREIGN KEY (paper_code, dept_id) REFERENCES papers(paper_code, dept_id));

INSERT INTO enrols VALUES
   (160, 172384, TO_DATE('22-Mar-1994', 'dd-mon-yyyy'), 01);
INSERT INTO enrols VALUES
   (444, 849294, TO_DATE('14-Jul-1992', 'dd-mon-yyyy'), 04);
INSERT INTO enrols VALUES
   (160, 384583, TO_DATE('07-Aug-1995', 'dd-mon-yyyy'), 01);
INSERT INTO enrols VALUES
   (160, 999999, TO_DATE('18-Aug-1991', 'dd-mon-yyyy'), 01);

My papers relation:
CREATE TABLE papers
   (paper_code      INT,
   EFTS             INT     NOT NULL,
   dept_id          INT     REFERENCES departments(dept_id),
   paper_cost       INT,
   PRIMARY KEY(paper_code, dept_id));

INSERT INTO papers VALUES
   (160, 0.18, 01, 800);

Any help to point me in the right direction would be great.

A: Many mistakes in the trigger.
BEGIN
    IF UPDATING THEN
(1)   IF ([:new.|:old.]date_enrolled < TO_DATE('01-Jan-1993', 'dd-mon-yyyy')) THEN
(1)      IF ([:new.|:old.]paper_code = 160) THEN
            UPDATE papers
            SET paper_cost = (:OLD.paper_cost - (:OLD.paper_cost * 0.1))
(2)         WHERE papers.paper_code = enrols[:new].paper_code;
       END IF;
    END IF;
    ELSE --inserting
(3)   IF ([:new.]date_enrolled < TO_DATE('01-Jan-1993', 'dd-mon-yyyy')) THEN
(3)      IF ([:new.]paper_code = 160) THEN
            UPDATE papers
            SET paper_cost = (:NEW.paper_cost - (:NEW.paper_cost * 0.1))
(2)         WHERE papers.paper_code = enrols[:new].paper_code;

(1): The trigger has two pseudo-rows available to it: NEW and OLD. When Updating, the OLD row contains the data as it currently exists in the table. The NEW row contains the row as it will look like after the Update completes. So you can't just call out date_enrolled. Do you mean :new.date_enrolled or :old.date_enrolled? The same thing for paper_code in two places.
(2): you are issuing an Update statement for table papers, yet you are referring to something called enrols. Where did that come from? You have not defined it. You and I know you mean the table enrols but the compiler doesn't know that. Besides, you don't need the table, you're already in the trigger for that table and you have the data you need at hand in one of the pseudo-rows. I think you want the one in :NEW but that's your decision. Also, as it appears that paper_cost is in both tables (not the best data modeling idea), you should probably change the :NEW.paper_cost also.
(3): in the Insert section of the trigger, the :OLD pseudo-row just has NULLs so it's a pretty safe bet you want to use :NEW here.
Not errors as such but just some technique: declare a local date variable called, oh, CutoffDate to place the result of the TO_DATE call. Then just refer to that variable instead of calling the function in two places. Also, a more direct way of reducing a value by 10% is SET paper_cost = :OLD.paper_cost * 0.9.
Also, as the same code is executed in both the inserting and updating sections, why not combine them?
So the new trigger would look something like this:
CREATE OR REPLACE TRIGGER discount_160
BEFORE INSERT OR UPDATE ON enrols
FOR EACH ROW
DECLARE
    CUTOFF  DATE := TO_DATE( '01-Jan-1993', 'dd-mon-yyyy' );
BEGIN
    IF :new.date_enrolled < CUTOFF AND
       :new.paper_code = 160 THEN
        :new.paper_cost := :old.paper_cost * 0.9;
        UPDATE papers
          SET paper_cost = :new.paper_cost
        WHERE paper_code = :new.paper_code;
    END IF;
END;

I haven't tried compiling it, let me know if I goofed up somewhere or if you have questions.

A: you can try to refer field paper_cost as papers.paper_cost in your statements, not using :NEW or :OLD


text:
Q: How to push notification to specific logged user. My code is shown below I am using event stream in front end. Yield function in back end. Storing client in redis queue.
I am storing users correctly in redis queue, but I don't know to send push notifications to specific logged user.
My problem is how to push notification to specific logged user.
Front end code:
  var source = new EventSource('/stream');
            source.onmessage = function (event) {

                 console.log(event)
            };

Back end code:
from redis import Redis
redis = Redis()

import time
from datetime import datetime
p = redis.pipeline()
 app.config['ONLINE_LAST_MINUTES'] = 5

def check_updates():
   yield 'data: %s \n\n' % data

@app.route('/stream')
   #@nocache
   def stream():
      return Response(check_updates(),mimetype='text/event-stream')

A: Here is a snippet shows how to use redis operate user:
http://flask.pocoo.org/snippets/71/
if you use flask-login, it's easy to get current_user and return the specify message for him/her by checking all the user's fields in database.


text:
Q: Interrupt a flow of data and disconnect devices Basically I'm creating an app that comunicates with two devices through bluetooth. At the beginning I do the connection to the first device, then to the second. At this point I start to recover the data from the two devices (a flow of number). When the user click on "Stop", I have to stop this data reading and disconnect the connected devices. How can I proceed according to you to implement this?
I use the react-native-ble-plx library
The first problem is about the function "stopConnection (device)"
I should pass the value of the device: this.model(this.props.device).
At the moment I receive the error.
Cannot read property 'cancelConnection' of undefined
The second problem is that the flow of data is continuous, so when I click on the Stop button about 10 second pass before to stop ("to try to stop xD"). Thank you
 constructor(props) {
    super(props);
    this.manager = new BleManager();
    this.state = {
      acc: [],
      gyr: [],
      mg: [],
};

scanDx() {
    this.manager.startDeviceScan(null, null, (error, device) => {
      if (error) {
        return;
      }
      if (device.name == this.model_dx(this.props.ModelDevice)) {
        this.manager.stopDeviceScan();
        device
          .connect()
          .then(() => {
            console.log("ConnectedDX.");
            console.log(" ");
            this.scanSx();
          })
          .then(() => {
            this.deviceService_Dx(device);
          })
          .catch(() => {
            Alert.alert("Alert.");
            Actions.homepage();
          });
      }
    });
  }
stopConnection (device) {
    device.cancelConnection()
    return new Promise((resolve, reject) => {
      resolve(console.log("Disconnected."))
    })
  }

  render() {
    device = this.model_dx(this.props.deviceModel)
    const pressure = this.state.values.hasOwnProperty(this.Pressure)
      ? this.state.values[this.Pressure].join(" ")
      : "-";
    return (
      <View>
        <Text>First Device </Text>
          <Text>{"Time:" + this.state.time}</Text>
          <Text>{"Acc:" + this.state.acc.join(" ")}</Text>
          <Text>{"Gyr:" + this.state.gyr.join(" ")}</Text>
          <Text>{"Mg:" + this.state.mg.join(" ")}</Text>
          <Text>{"Pressure:" + pressure}</Text>
          <Text>{"Msg:" + this.state.info}</Text>
        <View>
        <Text>Second Device: </Text>
          <Text>{"Time:" + this.state.time}</Text>
          <Text>{"Acc:" + this.state.acc_dx.join(" ")}</Text>
          <Text>{"Gyr:" + this.state.gyr_dx.join(" ")}</Text>
          <Text>{"Mg:" + this.state.mg_dx.join(" ")}</Text>
          <Text>{"Pressure:" + pressure}</Text>
          <Text>{"Msg:" + this.state.info}</Text>
        </View>
        <View>
        <TouchableOpacity
            style={[style.button, style.buttonOK]}
            onPress={() => this.stopConnection(device)} >
            <Text style={style.buttonTesto}>Stop</Text>
        </TouchableOpacity> </View>

A: There is a function in the react-native-ble-plx  module that stops scanning.

cancelDeviceConnection(deviceIdentifier: DeviceId): Promise

Usage
const manager = new BleManager();
manager.cancelDeviceConnection(DeviceId)

OR
If you have a device created through 'new Divice()'

new Device(nativeDevice: NativeDevice, manager: BleManager)

cancelConnection(): Promise

stopConnection (device) {
    device.cancelConnection()
        .then((device) => {
       // Do work on device with services and characteristics
    })
    .catch((error) => {
        // Handle errors
    });
  }
...
<TouchableOpacity
            style={[style.button, style.buttonOK]}
            onPress={() => this.stopConnection(device)} >
            <Text style={style.buttonTesto}>Stop</Text>
        </TouchableOpacity> </View>

A: You are passing undefined(out of scope) value to the stopConnection (device) function.
When devices connected
You can keep the reference of device1 and device2 by doing
this.device1 and
this.device2 or put it in array
while stoping you can use
this.device1.cancelConnection()
    .then((device)=>{
        })
    .catch(() => {
        });

or
stopConnection (device) {
    device.cancelConnection()
    return new Promise((resolve, reject) => {
      resolve(console.log("Disconnected."))
    })
  }
...
<TouchableOpacity
            style={[style.button, style.buttonOK]}
            onPress={() => this.stopConnection(this.device1)} >
            <Text style={style.buttonTesto}>Stop</Text>
        </TouchableOpacity> </View>

Example Code:
import {BleManager} from 'react-native-ble-plx';

    let connectedDevice = null;
    export default class BlePlx {
        constructor() {
            this.manager = new BleManager();
            this.scanAndConnect()
        }

    onDeviceDisconnected = (device) => {

        connectedDevice = null;

        this.manager && this.manager.destroy();
        this.manager = null;
    };

    disConnectDevice() {

        if (connectedDevice) connectedDevice.cancelConnection().then((device) => this.onDeviceDisconnected(device)).catch(() => {
        });
    }

    scanAndConnect() {

        this.manager.startDeviceScan(null, {scanMode: 2}, (error, device) => {
            if (error) {
                // Handle error (scanning will be stopped automatically)
                return
            }

            // Check if it is a device you are looking for based on advertisement data
            // or other criteria.;

            device.connect()
                .then((device) => {

                    this.device = device;
                    connectedDevice = device;

                    return device.discoverAllServicesAndCharacteristics()

                })
                .then(this.onConnected)
                .catch((error) => {

                });

            // Stop scanning as it's not necessary if you are scanning for one device.
            //this.manager.stopDeviceScan();
            // Proceed with connection.

        });

    }

    onConnected = (device) => {
// Do work on device with services and characteristics
        this.manager.servicesForDevice(device.id).then(this.getServices);
        this.manager.onDeviceDisconnected(device.id, (error, device) => {
            console.log('DisConnected ' + new Date().toISOString());
            this.onDeviceDisconnected(device)
        })

    };

}


text:
Q: How to make my code output six trues? function bouncer(arr) {
  rule=[false,null,0,"",undefined,NaN];
  for (i=0;i<arr.length;i++){
    dis=false;
    for(j=0;j<6;j++){
      if(arr[i]===rule[j]){dis=true;}
      break;
    }
    console.log(dis);
  }
}

bouncer([false, null, 0, NaN, undefined, ""]);

I want to get six true as output instead of one true and five false.
The reason is  clear that:
for the first time:false === false
result:true
for the second time:null === false
result:false
for the third time:0 === false
result:false
as the same reason until the sixth time:"" === false
result:false
How to fix my code to get the desired result?

A: Update:
If I get question right, in bouncer we need to check, if there all the items persist in the list of rules.
In this case I'd change the function bouncer like this:
const rule = [false, null, 0, "", undefined, NaN]

function bouncer(arr) {
  return arr.map((item) => {
    return rule.includes(item)
  })
}

bouncer([false, null, 0, NaN, undefined, ""])

What about this solution:
function bouncer(arr) {
  return arr.map((item) => item !== NaN)
}

bouncer([false, null, 0, NaN, undefined, ""]);

A: You should change your function to this:

function bouncer(arr) {
  rule=[false,null,0,"",undefined,NaN];
  for (i=0;i<arr.length;i++){
    dis=false;
    for(j=0;j<6;j++){
      if(arr[i]===rule[j] || isNaN(arr[i]) && isNaN(rule[j])){
        dis=true;
        break;
      }
    }
    console.log(dis);
  }
}

bouncer([false, null, 0, NaN, undefined, ""]);

It has two changes:

*

*you should break the inner loop when finding a match, and continue when not (you did it the other way around)

*you should perform a special check for NaN because JavaScript considers NaN !== NaN

A: There is a little bug in havenchyk's answer here.
To change arr[i]===rule[j] || isNaN(arr[i]) && isNaN(rule[j]) into arr[i]===rule[j] || typeof(arr[i])!=="string"  && isNaN(arr[i]) && isNaN(rule[j]).


text:
Q: Change anchor of leaflet icon I'm currently using a div icon to show a small graph as a marker on a leaflet map. The graphs change dynamically based on the day of week using data from a database, which changes the height of the graphs in the div icon HTML.
As the graphs change height I need to change the value of the icon anchor so the graphs remain attached to the correct location at their bottom left hand corner, using the heights of the graph to set this. Does anyone know of the best way to access and modify the anchors of div icons/markers once they've been added to the map? (I would prefer not to have to remove the makers and re-add them if possible)

A: The most simple would probably be to update the icon options (for iconSize and iconAnchor), then to use marker.setIcon(newOrUpdatedIcon) with the updated icon to re-draw the latter without affecting the marker latLng position.
Demo: http://jsfiddle.net/ve2huzxw/1/
In your case you would probably change the icon html content at the same time.


text:
Q: Matlab Matrix Multiplication Calculate Significant Figures First off, long time reader, first time poster. Thanks in advanced for all the
help this site has offered!
So the question!
I have two matrices in the form of the variables A and b that are inputs
to my matlab function (posted below). I would like to calculate the
significant figures used for the matrix inverse operation (matrix division)
from the result A, b matrices. However, I have no idea where to start
(matlab or mathmatically) to go about this approach. Help?
More context, using a square linear system (Ax=b) and I am seeing if its
singular or nonsingular and trying to find a solution(s).
% x = answer
% y = 0 if no solution, 1 if nonsingular, 2 if many solutions
% z = p is number of sig figs
%
function [ x, y, z ] = squareLinSysSolv(A, b)

if det(A) == 0
    % Matrix is singular and therefor many solutions
    x = A\b;
    y = 0; % Used as place holder to compile
    z = 5; % Used as place holder to compile
elseif det(A) ~= 0
    % Matrix does not equal to zero (perhaps a number very close to it or
    % far from it) and therefor has a unique solution.
    x = A\b;
    y = 1; % Used as place holder to compile
    z = 5; % Used as place holder to compile
end
end

Edit:
To make it a bit clear, z should be some integer which approximates (ceiling or floor value) a decimal number of significant figures at which A\b were calculated at.
Test Cases:
Test/Spec sheet of what is expected. Both A and b are matrices and the result should be something like so.
A =
    1.5000    2.3000    7.9000
    6.1000    3.2000   13.0000
   13.0000   21.0000   76.0000

b =
     1
     3
     5
>> [x,y,z] = squareLinSysSolv(A,b)
% the result of x = A\b
x =

    0.8580
    3.0118
   -0.9132
% determinant is not equal to zero
y =

     1
% Amount of sig figs/precision in calculation
z =

     15

A: There are a number of ways to do this. At its core, a floating point processor will compute an answer to a finite number of digits of precision. In most PCs, a standard double representation (which is what MATLAB would use), would give about 16 digits.
For instance, try this code and inspect the result:
clear all
eps
1-(1+eps/2)

The value eps is the machine epsilon -- essentially the smallest number that can be added to 1 and get an answer that is not 1. This value is around $2.2 \times 10^{-16}$, so that's where the 16 digits of precision comes from.
Now, when you compute A\b, MATLAB is calling one of many possible algorithms to compute the solution to $Ax=b$. Assuming that there is some error, we want to think about whether we can bound that error. A vector norm is a good way of looking at that:
$$b-x = e \implies |A^{-1}(b-x)| = |A^{-1}e|.$$
Computing the relative error, we may instead want to look at
$$\frac{||A^{-1}b||/||A^{-1}e||}{||b||/||e||}.$$
Using the properties of matrix and vector norms, we'll define a function of $A$, called the condition number:
$$\textrm{cond}(A) = ||A^{-1}||\cdot ||A||.$$
The matrix norm is very difficult to compute exactly, but it can be bounded:
$$ ||A|| \le \left(\sum_{i,j} a_{i,j}^2\right)^{1/2}. $$
What does this mean? Well, if you compute the matrix norm in this way, you can get a bound on the relative error of the solution, which should be enough for you to estimate the number of "significant digits," better known as "digits of precision." Indeed, the condition number is the upper bound of this relative error! So by computing the condition number, you know that your error will be no worse than that.
Finally, in MATLAB, to compute the condition number, type:
cond(A)


text:
Q: Proof of the Extended Liouville's Theorem I'm trying to prove the Extended Liouville's Theorem:

Let $f$ be an entire function. Assume that for some $k \in \mathbb{N}$, and sufficiently large $|z|$, we have that $|f(z)| \leq A + B |z|^k$. Prove that $f$ is a polynomal of degree at most $k$.

Proof: The case $k = 0$ is the original Liouville Theorem. Assume the claim is true for some $k \in \mathbb{N}$. We prove it for $k + 1 \in \mathbb{N}$. Define the function,
\begin{align}
g(z) =
\begin{cases}
\frac{f(z) - f(0)}{z} \quad z \neq 0, \\
f'(0) \; \; \; \; \quad z = 0.
\end{cases}
\end{align}
Noting that $0 \leq |f(0)| \leq A$, we have that, for $z \neq 0$,
\begin{align}
|g(z)| & = \frac{|f(z) - f(0)|}{|z|}, \\
& \leq \frac{|f(z)| + |f(0)|}{|z|}, \\
& \leq \frac{A + B|z|^{k+1} + A}{|z|}, \\
& = \frac{2A + B|z|^{k+1}}{|z|}, \\
& = \frac{2A}{|z|} + B |z|^k, \\
& \leq \frac{2A}{M} + B |z|^k, \\
& \equiv D + B |z|^k, \\
\end{align}
where the last inequality follows since the theorem is stated for $|z| \geq M$ for some $M \in \mathbb{R}$. Considering the compact domain bounded by a closed and bounded circle of radius $M$, we have that, since $g(z)$ is entire, and hence continuous, we have that,
\begin{align}
g(z) \leq N \quad for \quad |z| \leq M.
\end{align}
Since $g(z)$ is bounded such that is satisfies the statement of theorem for some $k \in \mathbb{N}$, we have that $g(z)$ is a polynomial of degree at most $k$. A simple rearrangement of the given piecewise function now allows us to argue that $f(z)$ is a polynomial of degree at most $k + 1$.
Does this proof make sense?

A: Yes, your proof is fine, but you should write
\begin{align}
|g(z) |\leq N \quad for \quad |z| \leq M.
\end{align}


text:
Q: Proving the associativity of Matrix Multiplication So, here's what I'm trying to prove right now.
Let $A \in M(m \times n, F)$, $B \in M(n \times s,F)$ and $C \in M(s \times p,F)$. Then:
$$A(BC) = (AB)C$$

Proof Attempt:
The linear maps corresponding to each of the matrices above are denoted as follows:
$$f:F^n \to F^m$$
$$g:F^s \to F^n$$
$$h:F^p \to F^s$$
Now, consider the following:
$[f \circ (g \circ h)](x) = f((g \circ h)(x) = f(g(h(x))) = (f \circ g)(h(x)) = [(f \circ g) \circ h](x)$
In other words, compositions of functions is associative. Since the matrix product corresponds to the composition of two linear maps, it follows that the above corresponds to the following law:
$$A(BC) = (AB)C$$
That proves the desired result.
I know how to prove the given result directly from the definition of matrix multiplication. However, my book seems to be focusing quite a lot on the relationship between function composition and matrix multiplication. In all honesty, that makes more sense in my mind so I'm trying to do the proofs of these laws with reference to that. Can someone have a look at what I've written above and see if it is correct or not? How could I improve the proof?

A: You mentioned that you are aware of the linear bijection between the space of matrices, and the space of linear maps; let me be more explicit. Let $m,n,p$ be positive integers. We can define a function $\alpha: M_{m \times n}(F) \to \text{Hom}(F^n, F^m)$ by the rule: for any $A \in M_{m \times n}(F)$, we define $\alpha(A): F^n \to F^m$ to be the function defined by
\begin{align}
\left(\alpha(A) \right)(x) &:= A \cdot x \qquad \text{for all $x \in F^n$.} \tag{$*$}
\end{align}
Now, you should verify that this function $\alpha$ is really a bijection between those spaces, and that it is linear (if you've gotten stuck, then maybe you should move on temporarily, but definitely be sure to come back to this and prove it rigorously). We can of course define a similar maps $\beta: M_{n \times p}(F) \to \text{Hom}(F^p, F^n)$ and $\xi: M_{m \times p}(F) \to \text{Hom}(F^p, F^m)$.
Now, the statement that "matrix product corresponds to function composition" means that the function $\xi$ has the following property: for all $A \in M_{m \times n}(F)$ and all $B \in M_{n \times p}(F)$,
\begin{align}
\xi(A \cdot B) &= \alpha(A) \circ \beta(B). \tag{$\ddot{\smile}$}
\end{align}
The way to read this equation in words is"the linear map associated with the product $A \cdot B$ equals the composition of the linear map associated with $A$ and the linear map associated with $B$" (verify using the definition that $\xi$ really does have this property).

Up until now, I have intentionally introduced new letters $\alpha, \beta, \xi$ to emphasize that these are all different functions with different domains and target spaces. However, usually what happens is people may write $\alpha(A)$ simply as $L_A$, to mean "left-multiplication by $A$", and similarly write $L_B$ to mean "left-multiplication by $B$" instead of $\beta(B)$. The reason for such language is evident from ($*$), because the value of the function $L_A$ on the vector $x$ is simply obtained by multiplying the vector $x$ on the left by the matrix $A$.
With such notation, the equation $(\ddot{\smile})$ may be written in a more memorable manner:
\begin{align}
L_{A \cdot B} &= L_A \circ L_B
\end{align}
This should make it more apparent that matrix product "really corresponds to" function composition (of the associated linear maps).
I hope you appreciate that this notation of left-multiplication is really much more convenient than the notation $\alpha, \beta, \xi$, which I have introduced so far (but of course, one needs to implicitly keep track of which $L$ refers to which).
One other thing to mention is that bijectivity of $\alpha$ in particular means it is injective so that if $\alpha(A_1) = \alpha(A_2)$ then $A_1 = A_2$. Or, if we use the $L$ notation, this is the same as saying if $L_{A_1} = L_{A_2}$ then $A_1 = A_2$. Similar statements hold for $\beta, \xi$. Now, the proof of matrix multiplication associativity becomes almost trivial, like you said
\begin{align}
L_{(AB)C} &= L_{AB} \circ L_C\\
& = \left(L_A \circ L_B\right) \circ L_C \\
&= L_A \circ \left(L_B \circ L_C \right) \\
&= L_A \circ L_{BC} \\
&= L_{A(BC)}.
\end{align}
Hence, by my remark about injectivity earlier, this implies $(AB)C = A(BC)$.

Final Words:

*

*You seemed to grasp the main idea of the proof. All I did was try to make super explicit what the "correspondence" between matrix multiplication and function composition is, so that the logic of the proof is airtight.

*Note that while the actual proof of associativity above is definitely shorter than the proof using explicit matrix multiplication, this proof requires some "background machinery"; and there were several details which I left for you to verify. So, this isn't necessarily a "quicker" proof. However, it is definitely more conceptually clear, and it is worth learning, because once you understand the correspondence between matrices and linear transformations, proving new/ more complicated theorems about matrices could then become a very quick proof if you rephrase it using linear maps (and sometimes, proving facts about linear maps becomes much more obvious once you consider the associated matrix).


text:
Q: Product between all combinations of a vector's elements Suppose I have a vector c(1, 2, 3, 4) with no duplicated values. I need a vector c(1 * 2, 1 * 3, 1 * 4, 2 * 3, 2 * 4, 3 * 4), so the multiplication is done in all possible combinations of this vector's values. Is there a way of doing that? Thanks in advance!

A: This is fun enough. I thought combn(1:4, 2, "*") would be the simplest solution but it actually does not work. We have to use combn(1:4, 2, prod) as Onyambu commented. The issue is: in an "N choose K" setting, FUN must be able to take a vector of length-K as input. "*" is not the right one.
## K = 2 case
"*"(c(1, 2))  ## this is different from: "*"(1, 2)
#Error in *c(1, 2) : invalid unary operator

prod(c(1, 2))
#[1] 2

We are going too far, but we will meet this sooner or later
Thanks Maurits Evers for elaboration on outer / lower.tri / upper.tri. Here is an adapted way to avoid generating those temporary matrices from outer and *****.tri:
tri_ind <- function (n, lower= TRUE, diag = FALSE) {
  if (diag) {
    tmp <- n:1
    j <- rep.int(1:n, tmp)
    i <- sequence(tmp) - 1L + j
    } else {
    tmp <- (n-1):1
    j <- rep.int(1:(n-1), tmp)
    i <- sequence(tmp) + j
    }
  if (lower) list(i = i, j = j)
  else list(i = j, j = i)
  }

vec <- 1:4
ind <- tri_ind(length(vec), FALSE, FALSE)
#$i
#[1] 1 1 1 2 2 3
#
#$j
#[1] 2 3 4 3 4 4

vec[ind[[1]]] * vec[ind[[2]]]
#[1]  2  3  4  6  8 12

The tri_ind function is wrapper of my this answer. It could be used as a fast and memory-efficient alternative for combn(length(vec), 2) or its outer-equivalence.
Originally I linked an finv function but it is not good for benchmarking, as it is designed for extracting a few elements from a "dist" object (a collapsed lower triangular matrix). If all elements of the triangular matrix are referenced, its index computation actually imposes unnecessary overhead. tri_ind is a better option.
library(bench)

benchmark index generation
bench1 <- function (n) {
  bench::mark("combn" = combn(n, 2),
              "tri_ind" = tri_ind(n, TRUE, FALSE),
              "upper.tri" = which(upper.tri(matrix(0, n, n)), arr.ind = TRUE),
              check = FALSE)
  }

## for small problem, `tri_ind` is already the fastest
bench1(100)
#  expression      min     mean  median      max `itr/sec` mem_alloc  n_gc n_itr
#  <chr>      <bch:tm> <bch:tm> <bch:t> <bch:tm>     <dbl> <bch:byt> <dbl> <int>
#1 combn        11.6ms   11.9ms  11.9ms  12.59ms      83.7    39.1KB     9    32
#2 tri_ind     189.3µs  205.9µs 194.6µs   4.82ms    4856.     60.4KB    21  1888
#3 upper.tri   618.4µs  635.8µs 624.1µs 968.36µs    1573.    411.7KB    57   584

## `tri_ind` is 10x faster than `upper.tri`, and 100x faster than `combn`
bench1(5000)
#  expression      min     mean   median      max `itr/sec` mem_alloc  n_gc
#  <chr>      <bch:tm> <bch:tm> <bch:tm> <bch:tm>     <dbl> <bch:byt> <dbl>
#1 combn         30.6s    30.6s    30.6s    30.6s    0.0327    95.4MB   242
#2 tri_ind    231.98ms 259.31ms 259.31ms 286.63ms    3.86     143.3MB     0
#3 upper.tri     3.02s    3.02s    3.02s    3.02s    0.332    953.6MB     4

benchmark on OP's problem
bench2 <- function (n) {
  vec <- numeric(n)
  bench::mark("combn" = combn(vec, 2, prod),
              "tri_ind" = {ind <- tri_ind(n, FALSE, FALSE);
                           vec[ind[[1]]] * vec[ind[[2]]]},
              "upper.tri" = {m <- outer(vec, vec);
                             c(m[upper.tri(m)])},
              check = FALSE)
  }

bench2(100)
#  expression      min     mean  median      max `itr/sec` mem_alloc  n_gc n_itr
#  <chr>      <bch:tm> <bch:tm> <bch:t> <bch:tm>     <dbl> <bch:byt> <dbl> <int>
#1 combn        18.6ms   19.2ms  19.1ms  20.55ms      52.2    38.7KB     4    22
#2 tri_ind     386.9µs  432.3µs 395.6µs   7.58ms    2313.    176.6KB     1  1135
#3 upper.tri   326.9µs  488.5µs 517.6µs 699.07µs    2047.      336KB     0  1024

bench2(5000)
#  expression      min     mean   median     max `itr/sec` mem_alloc  n_gc n_itr
#  <chr>      <bch:tm> <bch:tm> <bch:tm> <bch:t>     <dbl> <bch:byt> <dbl> <int>
#1 combn        48.13s   48.13s   48.13s  48.13s    0.0208    95.3MB   204     1
#2 tri_ind     861.7ms  861.7ms  861.7ms 861.7ms    1.16     429.3MB     0     1
#3 upper.tri     1.95s    1.95s    1.95s   1.95s    0.514    810.6MB     3     1

For me, it is interesting to know that combn is not written in compiled code. It actually has an R-level for loop inside. The various alternatives is just trying to speed it up in "N choose 2" case without writing compiled code.
Better choice??
Function combinations from gtools package uses recursive algorithm, which is problematic for big problem size. Function combn from combinat package does not use compiled code so it is no better than combn from R core. The RcppAlgos package by Joseph Wood has a comboGenearl function which is the fastest one I see so far.
library(RcppAlgos)

## index generation
bench3 <- function (n) {
  bench::mark("tri_ind" = tri_ind(n, FALSE, FALSE),
              "Joseph" = comboGeneral(n, 2), check = FALSE)
  }

bench3(5000)
#  expression      min     mean   median     max `itr/sec` mem_alloc  n_gc n_itr
#  <chr>      <bch:tm> <bch:tm> <bch:tm> <bch:t>     <dbl> <bch:byt> <dbl> <int>
#1 tri_ind       290ms    297ms    297ms   303ms      3.37   143.4MB     4     2
#2 Joseph        134ms    155ms    136ms   212ms      6.46    95.4MB     2     4

## on OP's problem
bench4 <- function (n) {
  vec <- numeric(n)
  bench::mark("tri_ind" = {ind <- tri_ind(n, FALSE, FALSE);
                           vec[ind[[1]]] * vec[ind[[2]]]},
              "Joseph" = comboGeneral(vec, 2, constraintFun = "prod", keepResults = TRUE),
              check = FALSE)
  }

bench4(5000)
#  expression      min     mean   median     max `itr/sec` mem_alloc  n_gc n_itr
#  <chr>      <bch:tm> <bch:tm> <bch:tm> <bch:t>     <dbl> <bch:byt> <dbl> <int>
#1 tri_ind       956ms    956ms    956ms   956ms      1.05     429MB     3     1
#2 Joseph        361ms    362ms    362ms   363ms      2.76     286MB     1     2

Joseph Wood has various answers on combinations / permutations. For example: Faster version of combn.

A: We can use combn with anonymous function call
combn(vec, 2, FUN = function(x) x[1] * x[2])
#[1]  2  3  4  6  8 12

data
vec <- 1:4

A: Here is the "outer + upper triangular part option"
m <- outer(1:4, 1:4)
as.numeric(m[upper.tri(m)])
#[1]  2  3  6  4  8 12

Another method is to index the elements of the upper/lower triangular part of a matrix directly and then calculate the pairwise product for those elements (adapted from this post)
upperouter <- function(x) {
    N <- length(x)
    i <- sequence(1:N)
    j <- rep(1:N, 1:N)
    (1:N)[i[i != j]] * (1:N)[j[j != i]]
}
upperouter(1:4)
#[1]  2  3  6  4  8 12

Benchmark analysis
It's interesting to compare the different methods in a microbenchmark analysis for a larger vector (e.g. 1:100):
upperouter <- function(x) {
    N <- length(x)
    i <- sequence(1:N)
    j <- rep(1:N, 1:N)
    (1:N)[i[i != j]] * (1:N)[j[j != i]]
}

finv <- function (n) {
  k <- 1:(n * (n - 1) / 2)
  j <- floor(((2 * n + 1) - sqrt((2 * n - 1) ^ 2 - 8 * (k - 1))) / 2)
  i <- j + k - (2 * n - j) * (j - 1) / 2
  cbind(i, j)
  }

N <- 100
library(microbenchmark)
res <- microbenchmark(
    combn  = combn(1:N, 2, prod),
    outer = {
        m <- outer(1:N, 1:N)
        as.numeric(m[upper.tri(m)])
    },
    upperouter = {
        upperouter(1:N)
    },
    finv = {
        vec <- 1:N
        ind <- finv(length(vec))
        vec[ind[, 2]] * vec[ind[, 1]]
    },
    sapply = {
        m <- sapply(1:N, "*", 1:N)
        as.numeric(m[upper.tri(m)])
    })
res
#Unit: microseconds
#       expr      min        lq      mean    median        uq       max neval
#      combn 6584.938 6896.0545 7584.8084 7035.9575 7886.5720 12020.626   100
#      outer  106.791  113.6535  157.3774  138.9205  160.5985   950.706   100
# upperouter  201.943  210.1515  277.0989  227.6370  259.1975  2806.962   100
#       finv  308.447  324.1960  442.3220  332.7250  375.3490  4128.325   100
#     sapply  232.805  249.9080  298.3674  283.8580  315.9145   556.463   100

library(ggplot2)
autoplot(res)