text:
Q: Windows Mobile 6.1: Can't access internal site via https Whe have several Motorola Symbols (don't remember the exact model) running Windows Mobile 6.1  They are used for entering data in the field, and then at the end of shift the employees come in and "sync" them via an application which utilizes web services.  We recently renewed our SSL certificate, and since then we've been unable to get them to sync over https.
Since the application wasn't giving good error message, I decided to see if I could load the page in IE which produces one of three error sitations (and it appears to be device dependant which one you get):

*

*Some hand helds just display a gray box (i.e. they don't load anything)

*some return a message saying "Cannot find 'https://<server>/<dir>/<file>' Make sure the path or Internet address is correct."

*finally some say "The page cannot be displayed because the Web site cannot be authenticated."

In trying to understand the situation better, I've noticed that:

*

*If I change https to http, they can always load the page

*If I revert to the old certificate, they work

*We renewed three certificates all with a new CA; if I try one of the other two it works

*

*the problem server is running IIS 6 under Windows Server 2003 Standard edition Service Pack 2

*Working server 1 is running IIS 6 under Windows Server 2003 Standard Edition Service Pack 2

*Working Server 2 is running IIS 7 under Windows Server 2008 R2 Standard Service Pack 1

*There is an intermediate certificates

*

*on both the 2003 boxes (haven't checked the 2008), the intermediate certificate does appear the Certificate (Local Computer) -> Intermediate Certification Authorities\certificates in the Certificates MMC Snapin

*openssl s_client -connect <server>:<port> -CAfile root.crt indicates the intermediate is installed properly

*It appears to work fine on other devices; but I've only done limited testing

*Under IE 7, Firefox 4/5 we receive no errors (tested under Windows 7)

*Under Firefox 3.5 we receive no errors (tested under the newest Ubuntu)

*Looking at the logs, I don't see any entries from the mobile units (although this is problematic as the server is really busy this time of year, so I could have missed them)

*In double checking the supported cipher suites, the working 2003 server has been secured (it passes PCI scans), so its supports fewer cipher suites than the non-working server, so I don't think its a cipher suite issue.

*Finally, I have tried to manually compare the certificates

*CNAMES, serial numbers, etc are obviously different

*On the two which work they have Object Identifier (2 5 4 9) = 154 W 12th Avenue where as the one which doesn't work has Object Identifier (2 5 4 9) = LEAVE_THIS_FIELD_BLANK  (the reason is we have a centeral group which actually submits/approves them and the centeral group is supposed to replace that text with the correct street address.  Obviously they missed it.)

*If you think its a problem, I can fairly easily have the certificate re-issued; I just hate to do it unecessarily.

*(Edit) Also, I've hooked up a laptop the same way the handhelds connect and can connect just fine; thus I don't think its a networking issue.

I would greatly appreciate any suggestions on how to proceede.  I think at this point my options are:

*

*Match the ciphers suites so they are identical (I doubt it will help, but the more apples to apples the better)

*Ask for the certificate to be re-issued with a correct address

*Move the webservices the hand helds use to communicate to one of the two servers they do work with (undersireable as they are open to the world where as the non-working server is only open to our WAN network; it could work short term)

A: Reissuring the certificate appears to have resolved the issue.
We corrected the address issue.  I also ended up generating a new private key, but I can't see how that's related as both should be 2048 bits.


text:
Q: Android : Restore time in resume I have question i have a chronometer in my app, when i back to my main window, and get back to Timer activity, I just want to resume a time on chronometer from CountDownTimer, how to to this ? Bundle doesn't help me and similar topics :( I will be very gratefull for any help.
public class Timer extends Activity {
    private boolean start = false; // Semafor to button
    private Chronometer timer; // Chronometr
    private CountDownTimer count; // CountDown class
    private final long startTime = 30 * 1000; // High
    private final long end = 1 * 1000; //LOw
    private ImageButton startB; // Button
    private int VIBRATION_TIME = 1000; //vibration time
    private Bundle state = new Bundle(); //button state
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_timer);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            // Show the Up button in the action bar.
            getActionBar().setDisplayHomeAsUpEnabled(true);
        }
        this.timer = ((Chronometer) findViewById(R.id.chronometer1));
        count = new MyCountDownTimer(startTime, end);
        timer.setText("00:" + String.valueOf(startTime / 1000));
        startB = (ImageButton) this.findViewById(R.id.start_pause);

        startB.setBackgroundResource(R.drawable.start_button);
        startB.setOnClickListener(new View.OnClickListener() {
            // click init
            @Override
            public void onClick(View v) {
                start = !start;
                if (start == true) {
                    count.start(); // start count
                    startB.setBackgroundResource(R.drawable.stop_button);
                } else {
                    count.cancel(); // pause count

                    startB.setBackgroundResource(R.drawable.start_button);
                }
            }
        });
    }
    ....
   @Override
    protected void onResume() {
        super.onResume();
        start = state.getBoolean("Button");

    }

    @Override
    protected void onPause() {
        super.onPause();
        state.putBoolean("Button", start);
        //count.cancel(); I don't wanna this!
    }

    class MyCountDownTimer extends CountDownTimer {
        public MyCountDownTimer(long startTime, long interval) {
            super(startTime, interval);
        }

        @Override
        public void onFinish() {
            timer.setText("00:00");
            // TO DO :

            Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
            v.vibrate(VIBRATION_TIME);
            startB.setBackgroundResource(R.drawable.start_button);
        }

        @Override
        public void onTick(long millisUntilFinished) {
            long tmp = millisUntilFinished / 1000;
                timer.setText("00:" + tmp);
        }
    }

}

A: Make use of onSaveInstanceState. Override this method, and save your current time into the Bundle. Then, on onCreate, extract the value from the Bundle and apply it to your View.

A: Hmm yes that is correct what Alex says but I have new idea. CountDownTimer start count, we click backButton activity is killed, but CountDownTimer still counting, but when I use this activity again, I can run new timer and this is crazy, there is any way to do this like that : In create method we check that CountDownTimer is still running and we just update a chronometer, but if not we create everything from new? At now my solutions is tricky: override the onBackPressed() and add this moveTaskToBack(true); but this not back to my mainActivity but return to telephone screen.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android GCM push notifications not working on devices with Jellybean I tested the app on Android Marshmallow, Lollipop and Kitkat, push works correctly on all of them except the device with Jellybean 4.2.2.
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.test.sample">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="com.test.sample.permission.C2D_MESSAGE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.GET_TASKS" />

    <permission
        android:name="com.test.sample.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
<uses-permission android:name="com.test.sample.permission.C2D_MESSAGE"></uses-permission>
    <application
        android:name="android.support.multidex.MultiDexApplication"
        android:allowBackup="true"
        android:icon="@drawable/sgrficon"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppFullScreenTheme">

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/gcmKey" />

        <activity
            android:name="com.test.sample.SplashActivity"
            android:noHistory="true"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.test.sample.LandingPage"
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme" />
        <activity
            android:name="com.test.sample.WebfragmentActivity"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.test.sample.LandingPage" />
        </activity>
        <receiver
            android:name="com.google.android.gms.gcm.GcmReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="com.test.sample" />
            </intent-filter>
        </receiver>

        <service android:name=".GcmPushService">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE"></action>
            </intent-filter>
        </service>
        <service
            android:name=".GcmIntentService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.android.gms.iid.InstanceID" />
            </intent-filter>
        </service>

        <activity
            android:name=".PdfFragmentActivity"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme"></activity>
    </application>
</manifest>

build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"
    dexOptions {
        javaMaxHeapSize "4g"
    }
    defaultConfig {
        applicationId "com.test.sample"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    configurations {
        all*.exclude group: 'com.google.firebase', module: 'firebase-common'
    }
    configurations.all {
        resolutionStrategy {
            force 'com.android.support:design:24.1.1'
            force 'com.android.support:support-v4:24.1.1'
            force 'com.android.support:appcompat-v7:24.1.1'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'com.google.maps.android:android-maps-utils:0.4+'

    compile 'com.android.volley:volley:1.0.0'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.android.support:design:24.1.1'
    compile 'com.afollestad.material-dialogs:core:0.8.6.2'
    compile 'com.android.support:cardview-v7:24.1.1'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support:recyclerview-v7:24.1.1'
    compile 'com.google.android.gms:play-services:9.4.0'
}
apply plugin: 'com.google.gms.google-services'

A: If I were you, I would try demo from Google on GCM and compare to my code.
https://github.com/google/gcm/tree/master/samples/android/gcm-demo
It supports Android 4.X (API-15)


text:
Q: Getting the uploaded Source bundle from aws elasticbeanstalk I'm using AWS Beanstalk to deploy my java application ,and i created the zip file which i uploaded.
Now the question is can i download the source bundle that i uploaded to my pc again ? and where is the path where is stored ?
Thanks !

A: Your application versions are stored on S3.
You can easily access them by heading to Beanstalk home page, then click on your application name (/!\ not the environment name) and click on 'Application versions' on the left menu.
From there you can see all the zip files you uploaded and where each one is deployed. Then you can either download, delete or deploy them by selecting one and using the 'Action' button at the top.


text:
Q: How to embed WAR structure into desktop application? We have an application written in Java in which the UI will be a relatively small part. We want to create a modern, consumer orientated UI and came to the conclusion that Swing would not be able to offer what we were after. After much deliberation, we decided to try build the UI using Vaadin, as although our application can not run on the web (it is p2p), Vaadin offered a fluid and good looking experience out of the box. Because of of this our application does not have a WAR structure which is required for Vaadin.
The idea is that we'll create a small embeded web server that will serve up a Vaadin UI to the user's local web browser (which we'll launch using java.awt.Desktop.browse()). We still have the problem though of how to go about embedding a WAR structure into an existing project. Our build tool is Maven and you can view the project source code: https://github.com/sanity/tahrir

A: You can embed Jetty: Here is how.
Example:
Server server = new Server(8080);
Context root = new Context(server,"/",Context.SESSIONS);
root.addServlet(new ServletHolder(new HelloServlet("Ciao")), "/*");
server.start();

If you want to run a WAR, here is an example on how to do that
Here is the relevant code:
server = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort(PORT);
connector.setHost("127.0.0.1");
server.addConnector(connector);

WebAppContext wac = new WebAppContext();
wac.setContextPath("/");
wac.setWar("./web");    // this is path to the .WAR
server.setHandler(wac);
server.setStopAtShutdown(true);
server.start();

A: Vaadin is a web application framework - and web applications will expect to have a WAR structure.
Now, if you're trying to avoid having stick all your classes in WEB-INF/lib or WEB-INF/classes - that's fine. By embedding Jetty, you can use all the classes on the classpath without having to stick them in a certain place.
However, you'll have to do a fair bit of work constructing and configuring the web application within Jetty. I imagine the easiest approach to create a WAR structure within your JAR on the class path (or to create a sibling WAR) with all of the other webresources such as WEB-INF/web.xml, VAADIN/themes etc. - but without the WEB-INF/lib and WEB-INF/classes - which is what I think you are trying to avoid.
Note, I have not done this myself, but I believe that's both possible and the path of least resistance.


text:
Q: How does the trap+missile part of a 3stacked missile spell work? Is a Missile+Trap+Missile spell worth it?
I hadn't had the time to experiment with the trap carrier so far. Do they go off instantly in large crowds or is there a delay? Do they fire against single mobs at all?
Is it worth building a spell like this:

*

*S1: missile/ricochet4/homing

*S2: trap

*S3: missile spray5/homing anti crowd spell?

**edited: **
removed most of the questions for clarity as requested by more experienced stackers


text:
Q: Symfony5/Doctrine : Create an Entity without saving to a database I have a remote third-party REST API. I'm trying to represent its data using an Entity called Offer, however I don't want to store it in a database.
The Offer entity should have a Repository in which I'll use Symfony\Component\HttpClient in order to manage data using GET and POST to the API.
If I try remove the @ORM annotatinos in the Entity class, I get No identifier/primary key specified for Entity "App\Entity\Offer". Every Entity must have an identifier/primary key. or Class "App\Entity\Offer" is not a valid entity or mapped super class. errors.
In other words, I don't want an 'Offer' table to be created after using php bin\console doctrine:migrations:migrate
Is there a way persist entities through an API (and not a database) using Doctrine?
Edit : Alternatively, how can I create an Entity linked to a Repository, without using Doctrine?

A: Doctrine is specifically built for database storage, so I don't think it's a smart idea to try and use it for storage in an external API. However if you want to do it anyway, then you'll probably have to implement a repository which makes use of the http client.
All in all I'd recommend you go for a different approach leaving an ORM out of the picture completely.

A: But behind your API, there is no database ? Or maybe you're using ElasticSearch or solution like this ? If you have a database, you should keep Doctrine :)
However, if you really don't want it, you can do someting like this: keep your entity, remove all @ORM\* annotations, remove all use Doctrine\*, and in your repository remove extends EntityRepository (very important).
You can add your own abstract Repository class to extends your repositories and with a method called getEntity() like that : abstract protected function getEntity() then in your repository :
protected function getEntity(): string
{
    return YourEntity::class;
}

public function foo() {
   $entityClass = $this->getEntity();
   $entity = new $entityClass();
}


text:
Q: Rich:Columns - FilterBy Good morning!!
I have a dynamic datatable and I'm using Columns of Richfaces, but when I assign the value to FilterBy, it does not work.
Can anyone help me?
Woe is my code ..
<rich:dataTable id="dtAtendimento" value="#{CadastroAtendimentoTecnico.listaAtendimento}" var="atendimento">
    <rich:columns index="index" value="#{CadastroAtendimentoTecnico.listaCampos}" var="column" filterBy="#{column.nomeAtributo}" filterEvent="onKeyUp">
        <f:facet name="header">
            <h:outputText value="#{column.label}"/>
        </f:facet>
        <h:outputText value="#{atendimento[column.nomeAtributo]}"/>
    </rich:columns>
</rich:dataTable>

A: Try adding sortBy="#{column.nomeAtributo}"  and sortOrder to rich:columns it will work.
I came to know that we have such problems on early version.
Please try RF 3.2.1. I think it should solve the problem otherwise.

A: From what I can see you are using the wrong attribute in filterBy. You want to use nesting to specify where to find the element to sort on. Something like #{atendimento(column.nomeAtributo)}, but I am not in a place I can test it. What this essentially does is evaluate the name of the column and then calls the getter with the same name off of your row object atendimento. Sorry if the nesting syntax doesn't work, but I think nesting is your answer.
If #{atendimento[column.nomeAtributo]} works to print the value then that is what you want, but I would only expect it to work if nomeAtributo is an integer for array referencing.

A: I've come across another issue with filterBy which can cause problems. We had the filterBy working on entities in a certain business state (active, expired etc) but not in others. The state of the entity had nothing to do with the actual filter value.
When I used a filterMethod and did the filtering on the backing bean it worked fine. It turned out that filterBy submits the whole form while on my inputText for the filterMethod I used ajaxSingle. A validation failed when you submitted that form in total but the validation error was swallowed.


text:
Q: DRBD device temporarily disappearing across different kernel versions? After upgrading from an old kernel to a new kernel version and booting into the new kernel the DRBD logical device was gone.
Think nothing under /proc/drbd.
This is a major problem as I have DRBD running in a cluster, with a heartbeat running between the Primary and Secondary nodes.
After rebooting into the new kernel however, the DRBD device has re-appeared. Has anyone experienced fluctuating behaviour of this sort?
Thanks.


text:
Q: Why cant I just import everything? I love Java. I have heard a lot of bad things about java on how it is slow and all, but for me, it seems like a better alternative to C and C++. The only reason that I don't like java is because the standard library is SO BIG and it takes forever to just set up all of the import statements in my code. Why can't I just do
import java.*;

and have all of my import statements in one neat package. I am not making a big program so speed is not an issue. Thank you!

A: Import statements are only for the aid of the developer, at runtime they've been used to fully qualify the classes anyway. Further, it's very similar to the namespace feature in C++ and you wouldn't want to make everything a global there either (although Java does effectively import java.lang.* by default). Finally, a free IDE like eclipse or Netbeans will help manage import(s) for you.

A: There are quite a few classes (especially common or basic classes) that have the same name but are parts of different packages. They are thus different code, doing different things, or the same things in different ways. Consider the Hibernate and JPA entity classes as just one of many examples. If you imported everything, you would have no way to control which class is actually compiled and used. Using an IDE, like so many are recommending, lets you see the possibilities and choose the one you really need (and the IDE will then usually automatically write the import statement for you).
On the flip side, there is nothing wrong with fully qualifying all your classes. It just is wordy and not elegant.
So you see that the import statements don't really import anything, they are just conveniences to avoid having to prepend all your classes with packages.


text:
Q: How to return MbElement[] from Java to ESQL? I want to pass REFERENCE as a argument to Java method and transform it then i want to return in the form of MbElement[].
Till now I tried the following.
I am using the following code in ESQL
CALL retrieveData(CAST(AGE AS INTEGER),OutputRoot.XMLNSC.employees) into RESULT;

Calling java method as follows:
create function retrieveData(IN empId INTEGER,INOUT outputXML REFERENCE)
returns integer
language java
external name "com.test.util.Database.retrieve";

Below is the java method:
public static Long retrieve(Long employeeAge,MbElement[] outputRoot)
{
MbElement xmlnsc = outputRoot[0].getFirstElementByPath("XMLNSC");
MbElement employees =        xmlnsc.createElementAsFirstChild(MbElement.TYPE_NAME, "employees", null);
MbElement employee =employees.createElementAsLastChild(MbElement.TYPE_NAME, "employee", "");
employee.createElementAsLastChild(MbElement.TYPE_NAME, "emp-id", 1001);
employee.createElementAsLastChild(MbElement.TYPE_NAME, "emp-name", "john");
employee.createElementAsLastChild(MbElement.TYPE_NAME, "emp-age", 30);
employee.createElementAsLastChild(MbElement.TYPE_NAME, "emp-city", "london");

return new Long(0);
}

While testing the above code, it is throwing SqlRoutine::clearDownChildEnv error.
How to resolve this. Thanks in advance...

A: I got output.
I have used the following way:
DECLARE RESULT INTEGER;

SET OutputRoot.XMLNSC.employees=null;

DECLARE outputref REFERENCE TO OutputRoot.XMLNSC.employees;

CALL retrieveData(CAST(AGE AS INTEGER),outputref) into RESULT;

Its working fine.


text:
Q: How to find whether my callout is using TLS 1.0 or 1.1? We have just upgraded our SAP server to support TLS 1.1. Now, I need to find out using which protocol version my callouts are going to SAP.
I have checked debug log but did not any such information. Please suggest. Thanks

A: According to this Knowledgebase article, TLS 1.2 was supported for Apex callouts as of summer 2015.

Apex callouts, Workflow outbound messaging, Delegated Authentication,
  and other HTTPS callouts now support TLS (Transport Layer Security)
  1.1, TLS 1.2 ...

A: You can view Login History from Setup->Manage Users-> Login History how users are accessing Salesforce and which TLS protocol they are using.

A: Based on the TLS 1.1 Disablement docs https://help.salesforce.com/articleView?id=000321556&type=1&mode=1
TLS 1.1 is disabled for both inbound and outbound requests. ANY https connection to salesforce will require TLS 1.2 as of late 2019.


text:
Q: Difference in query execution plan between MySQL 5.5.54 and mariadb 5.5.56 I am executing a SELECT on 2 Hosts, "old db" running mysql 5.5.54 and "new db" running mariadb 5.5.56. Both the runtime and the EXPLAIN show a difference, with the mariadb being significantly slower. The data on "new db" is a very recent dump of "old db"
EXPLAIN on "old db":
explain SELECT
    b.tariff as tariff, b.benefitType as benefitType, b.name as name,
    b.code as code, SUM(b.effQuantPckType) as `count`,
    SUM(effCalcAmtVat) as `amount`,
    SUM(effAmt) as `amountAL`, SUM(effAmt2) as `amountTL`
FROM
    benefitCombined AS b
    LEFT OUTER JOIN invoice AS inv ON inv.id = b.invoice
WHERE (invoicePart != 'aaaaaaaaaaaaaaaaaaaa' OR invoice != 'aaaaaaaaaaaaaaaaaaaa')
  AND executingDoctor = 'dqwjvgbskiaaaacsonmj'
  AND b.begin >= '2018-06-16 00:00:00' AND
      b.begin <= '2018-07-16 23:59:57'
  AND 1=1
GROUP BY
    benefitType, code;

+----+--------------+---------------+--------+---------------+------+---------+-----------+--------+----------------------------------------------+
| id | select_type  | table         | type   | possible_keys | key  | key_len | ref       | rows   | Extra                                        |
+----+--------------+---------------+--------+---------------+------+---------+-----------+--------+----------------------------------------------+
|  1 | PRIMARY      | <derived2>    | ALL    | NULL          | NULL | NULL    | NULL      | 287344 | Using where; Using temporary; Using filesort |
|  1 | PRIMARY      | invoiceBase   | eq_ref | id            | id   | 20      | b.invoice |      1 | Using index                                  |
|  2 | DERIVED      | benefitBase   | ALL    | NULL          | NULL | NULL    | NULL      | 285328 | Using where                                  |
|  3 | UNION        | benefitTarmed | ALL    | NULL          | NULL | NULL    | NULL      |      1 | Using where                                  |
| NULL | UNION RESULT | <union2,3>    | ALL    | NULL          | NULL | NULL    | NULL      |   NULL |                                              |
+----+--------------+---------------+--------+---------------+------+---------+-----------+--------+----------------------------------------------+
5 rows in set (3.34 sec)

SHOW CREATE on "old db":
show create table invoice \G;
*************************** 1. row ***************************
                View: invoice
         Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`c0515_dwh`@`%` SQL SECURITY DEFINER VIEW `invoice` AS (
select  `invoiceBase`.`id` AS `id`,`invoiceBase`.`created` AS `created`,
    `invoiceBase`.`begin` AS `begin`,`invoiceBase`.`end` AS `end`,
    `invoiceBase`.`formatType` AS `formatType`,`invoiceBase`.`invUID` AS `invUID`,
    `invoiceBase`.`traStat` AS `traStat`,`invoiceBase`.`invStat` AS `invStat`,
    `invoiceBase`.`patient` AS `patient`,`invoiceBase`.`provider` AS `provider`,
    `invoiceBase`.`biller` AS `biller`,`invoiceBase`.`debitor` AS `debitor`,
    `invoiceBase`.`name` AS `name`,`invoiceBase`.`amtDue` AS `amtDue`,
    `invoiceBase`.`law` AS `law`,`invoiceBase`.`reason` AS `reason`,
    `invoiceBase`.`amtTotal` AS `amtTotal`,`invoiceBase`.`amtPrepaid` AS `amtPrepaid`,
    `invoiceBase`.`amtPaid` AS `amtPaid`,`invoiceBase`.`amtPaidDirect` AS `amtPaidDirect`,
    `invoiceBase`.`amtFee` AS `amtFee`,`invoiceBase`.`splitFac` AS `splitFac`,
    `invoiceBase`.`invoiceType` AS `invoiceType`,`invoiceBase`.`invoiceOptimal` AS `invoiceOptimal`,
    `invoiceBase`.`patientCopy` AS `patientCopy`,`invoiceBase`.`diagnoses` AS `diagnoses`,
    `invoiceBase`.`customerNumber` AS `customerNumber`,`invoiceBase`.`traStatDate` AS `traStatDate`,
    `invoiceBase`.`invStatDate` AS `invStatDate`,`invoiceBase`.`oldInvoiceNr` AS `oldInvoiceNr`,
    `invoiceBase`.`newInvoiceNr` AS `newInvoiceNr`,`invoiceBase`.`mandator` AS `mandator`,
    `invoiceBase`.`account` AS `account`,`invoiceBase`.`cancReqFlag` AS `cancReqFlag`,
    `invoiceBase`.`cancReqDate` AS `cancReqDate`,`invoiceBase`.`claimNr` AS `claimNr`,
    `invoiceBase`.`claimReqFlag` AS `claimReqFlag`,`invoiceBase`.`claimReqDate` AS `claimReqDate`,
    `invoiceBase`.`depReqFlag` AS `depReqFlag`,`invoiceBase`.`depReqDate` AS `depReqDate`,
    `invoiceBase`.`canton` AS `canton`,`invoiceBase`.`amtObligations` AS `amtObligations`,
    `invoiceBase`.`amtTax` AS `amtTax`,`invoiceBase`.`remarks` AS `remarks`,
    `invoiceBase`.`cancRemarks` AS `cancRemarks`,`invoiceBase`.`claimRemarks` AS `claimRemarks`,
    `invoiceBase`.`depRemarks` AS `depRemarks`,`invoiceBase`.`p02InvNr` AS `p02InvNr`,
    `invoiceBase`.`p02InvDate` AS `p02InvDate`,`invoiceBase`.`invoiceDate` AS `invoiceDate`,
`invoiceBase`.`debMngmt` AS `debMngmt`,
    (round(((`invoiceBase`.`amtTotal` * `invoiceBase`.`splitFac`) * 20),
                0) / 20) AS `calcAmtTotal`,round((`invoiceBase`.`amtPrepaid` * `invoiceBase`.`splitFac`),
                        2) AS `calcAmtPrepaid`,round((`invoiceBase`.`amtTax` * `invoiceBase`.`splitFac`),
                2) AS `calcAmtTax`,round((`invoiceBase`.`amtObligations` * `invoiceBase`.`splitFac`),
        2
    ) AS `calcAmtObligations`,
        2) + `invoiceBase`.`amtPaid`) + `invoiceBase`.`amtPaidDirect`) AS `calcAmtPaid`,

character_set_client: latin1
collation_connection: latin1_swedish_ci

...
show create table benefitCombined \G;
*************************** 1. row ***************************
                View: benefitCombined
         Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`c0515_dwh`@`%` SQL SECURITY DEFINER VIEW `benefitCombined` AS (
select  `benefitBase`.`id` AS `id`,`benefitBase`.`additionType` AS `additionType`,
    `benefitBase`.`end` AS `end`,`benefitBase`.`eanExecuting` AS `eanExecuting`,
    `benefitBase`.`eanResponsible` AS `eanResponsible`,`benefitBase`.`unitFac` AS `unitFac`,
    `benefitBase`.`extFac` AS `extFac`,`benefitBase`.`amountQty1` AS `amountQty1`,
    `benefitBase`.`orderNumber` AS `orderNumber`,`benefitBase`.`srvAtts` AS `srvAtts`,
    `benefitBase`.`tariff` AS `tariff`,`benefitBase`.`benefitType` AS `benefitType`,
    `benefitBase`.`code` AS `code`,`benefitBase`.`executingDoctor` AS `executingDoctor`,
    `benefitBase`.`responsibleDoctor` AS `responsibleDoctor`,
    `benefitBase`.`obligation` AS `obligation`,`benefitBase`.`refCode` AS `refCode`,
    `benefitBase`.`quantity` AS `quantity`,`benefitBase`.`effQuant` AS `effQuant`,
    `benefitBase`.`begin` AS `begin`,`benefitBase`.`unit` AS `unit`,
    `benefitBase`.`scaleFac` AS `scaleFac`,`benefitBase`.`amount` AS `amount`,
    `benefitBase`.`effAmt` AS `effAmt`,`benefitBase`.`vatRate` AS `vatRate`,
    `benefitBase`.`negObligation` AS `negObligation`,`benefitBase`.`sessionNr` AS `sessionNr`,
    `benefitBase`.`pckMult` AS `pckMult`,`benefitBase`.`pckType` AS `pckType`,
    `benefitBase`.`pckUnits` AS `pckUnits`,`benefitBase`.`srvMin` AS `srvMin`,
    `benefitBase`.`name` AS `name`,`benefitBase`.`invoicePart` AS `invoicePart`,
    `benefitBase`.`created` AS `created`,`benefitBase`.`session` AS `session`,
    `benefitBase`.`patient` AS `patient`,`benefitBase`.`medicalCase` AS `medicalCase`,
    `benefitBase`.`invoice` AS `invoice`,`benefitBase`.`owner` AS `owner`,
    0 AS `unitFac2`,0 AS `extFac2`,0 AS `amount2Qty1`,NULL AS `bodyLoc`,
    0 AS `unit2`,0 AS `scaleFac2`,0 AS `amount2`,0 AS `effAmt2`,
    `benefitBase`.`amount` AS `calcAmtVat`,`benefitBase`.`effAmt` AS `effCalcAmtVat`,
            (`benefitBase`.`amount` / (1 + (`benefitBase`.`vatRate` / 100))) AS `calcAmtWoVat`,
            (`benefitBase`.`effAmt` / (1 + (`benefitBase`.`vatRate` / 100))) AS `effCalcAmtWoVat`,
NULL AS `calcMinTot`,NULL AS `effCalcMinTot`,
ifnull(round((`benefitBase`.`effAmt` / nullif(`benefitBase`.`amountQty1`,
                                0)),3),0
      ) AS `effQuantPckType` from  `benefitBase`
    where  (((`benefitBase`.`invoicePart` <> 'aaaaaaaaaaaaaaaaaaaa')
                      and  (`benefitBase`.`invoicePart` is not null))
              or  ((`benefitBase`.`invoice` <> 'aaaaaaaaaaaaaaaaaaaa')
                      and  (`benefitBase`.`invoice` is not null))
           )
    )
UNION all (
SELECT  `benefitTarmed`.`id` AS `id`,`benefitTarmed`.`additionType` AS `additionType`,
    `benefitTarmed`.`end` AS `end`,`benefitTarmed`.`eanExecuting` AS `eanExecuting`,
    `benefitTarmed`.`eanResponsible` AS `eanResponsible`,
    `benefitTarmed`.`unitFac` AS `unitFac`,`benefitTarmed`.`extFac` AS `extFac`,
    `benefitTarmed`.`amountQty1` AS `amountQty1`,`benefitTarmed`.`orderNumber` AS `orderNumber`,
    `benefitTarmed`.`srvAtts` AS `srvAtts`,`benefitTarmed`.`tariff` AS `tariff`,
    `benefitTarmed`.`benefitType` AS `benefitType`,`benefitTarmed`.`code` AS `code`,
    `benefitTarmed`.`executingDoctor` AS `executingDoctor`,
    `benefitTarmed`.`responsibleDoctor` AS `responsibleDoctor`,
    `benefitTarmed`.`obligation` AS `obligation`,`benefitTarmed`.`refCode` AS `refCode`,
    `benefitTarmed`.`quantity` AS `quantity`,`benefitTarmed`.`effQuant` AS `effQuant`,
    `benefitTarmed`.`begin` AS `begin`,`benefitTarmed`.`unit` AS `unit`,
    `benefitTarmed`.`scaleFac` AS `scaleFac`,`benefitTarmed`.`amount` AS `amount`,
    `benefitTarmed`.`effAmt` AS `effAmt`,`benefitTarmed`.`vatRate` AS `vatRate`,
    `benefitTarmed`.`negObligation` AS `negObligation`,`benefitTarmed`.`sessionNr` AS `sessionNr`,
    `benefitTarmed`.`pckMult` AS `pckMult`,`benefitTarmed`.`pckType` AS `pckType`,
    `benefitTarmed`.`pckUnits` AS `pckUnits`,`benefitTarmed`.`srvMin` AS `srvMin`,
    `benefitTarmed`.`name` AS `name`,`benefitTarmed`.`invoicePart` AS `invoicePart`,
    `benefitTarmed`.`created` AS `created`,`benefitTarmed`.`session` AS `session`,
    `benefitTarmed`.`patient` AS `patient`,`benefitTarmed`.`medicalCase` AS `medicalCase`,
    `benefitTarmed`.`invoice` AS `invoice`,`benefitTarmed`.`owner` AS `owner`,
    `benefitTarmed`.`unitFac2` AS `unitFac2`,`benefitTarmed`.`extFac2` AS `extFac2`,
    `benefitTarmed`.`amount2Qty1` AS `amount2Qty1`,`benefitTarmed`.`bodyLoc` AS `bodyLoc`,
    `benefitTarmed`.`unit2` AS `unit2`,`benefitTarmed`.`scaleFac2` AS `scaleFac2`,
    `benefitTarmed`.`amount2` AS `amount2`,`benefitTarmed`.`effAmt2` AS `effAmt2`,
        (`benefitTarmed`.`amount` + `benefitTarmed`.`amount2`) AS `calcAmtVat`,
        (`benefitTarmed`.`effAmt` + `benefitTarmed`.`effAmt2`) AS `effCalcAmtVat`,
        ((`benefitTarmed`.`amount` + `benefitTarmed`.`amount2`) / (1 + (`benefitTarmed`.`vatRate` / 100))) AS `calcAmtWoVat`,
        ((`benefitTarmed`.`effAmt` + `benefitTarmed`.`effAmt2`) / (1 + (`benefitTarmed`.`vatRate` / 100))) AS `effCalcAmtWoVat`,
        (`benefitTarmed`.`srvMin` * `benefitTarmed`.`quantity`) AS `calcMinTot`,
        (`benefitTarmed`.`srvMin` * `benefitTarmed`.`effQuant`) AS `effCalcMinTot`,ifnull(round(((`benefitTarmed`.`effAmt` + `benefitTarmed`.`effAmt2`) / nullif((`benefitTarmed`.`amountQty1` + `benefitTarmed`.`amount2Qty1`),0)),3),0) AS `effQuantPckType`
from  `benefitTarmed`
where  (((`benefitTarmed`.`invoicePart` <> 'aaaaaaaaaaaaaaaaaaaa')
                  and  (`benefitTarmed`.`invoicePart` is not null)
              )
          or  ((`benefitTarmed`.`invoice` <> 'aaaaaaaaaaaaaaaaaaaa')
                  and  (`benefitTarmed`.`invoice` is not null)))
      )
character_set_client: latin1
collation_connection: latin1_swedish_ci
1 row in set (0.00 sec)

SHOW INDEX on "old db":
show index from benefitBase from c0515_dwh;
+-------------+------------+-------------------------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table       | Non_unique | Key_name                            | Seq_in_index | Column_name       | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------------+------------+-------------------------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| benefitBase |          0 | id                                  |            1 | id                | A         |      275913 |     NULL | NULL   |      | BTREE      |         |               |
| benefitBase |          1 | benefitBase_created_index           |            1 | created           | A         |      275913 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_tariff_index            |            1 | tariff            | A         |          13 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_code_index              |            1 | code              | A         |          15 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_executingDoctor_index   |            1 | executingDoctor   | A         |         249 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_responsibleDoctor_index |            1 | responsibleDoctor | A         |          17 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_obligation_index        |            1 | obligation        | A         |          13 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_begin_index             |            1 | begin             | A         |       39416 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_negObligation_index     |            1 | negObligation     | A         |          13 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_name_index              |            1 | name              | A         |          17 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_owner_index             |            1 | owner             | A         |         226 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_patient_index           |            1 | patient           | A         |       30657 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitBase |          1 | benefitBase_session_index           |            1 | session           | A         |      275913 |     NULL | NULL   | YES  | BTREE      |         |               |
+-------------+------------+-------------------------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

show index from benefitTarmed from c0515_dwh;
+---------------+------------+---------------------------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table         | Non_unique | Key_name                              | Seq_in_index | Column_name       | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+---------------+------------+---------------------------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| benefitTarmed |          0 | id                                    |            1 | id                | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_created_index           |            1 | created           | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_tariff_index            |            1 | tariff            | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_code_index              |            1 | code              | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_executingDoctor_index   |            1 | executingDoctor   | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_responsibleDoctor_index |            1 | responsibleDoctor | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_obligation_index        |            1 | obligation        | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_begin_index             |            1 | begin             | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_negObligation_index     |            1 | negObligation     | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_name_index              |            1 | name              | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_patient_index           |            1 | patient           | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| benefitTarmed |          1 | benefitTarmed_owner_index             |            1 | owner             | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
+---------------+------------+---------------------------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

show index from invoiceBase from c0515_dwh;
+-------------+------------+----------------------------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table       | Non_unique | Key_name                         | Seq_in_index | Column_name    | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------------+------------+----------------------------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| invoiceBase |          0 | id                               |            1 | id             | A         |       40574 |     NULL | NULL   |      | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_created_index        |            1 | created        | A         |       40574 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_begin_index          |            1 | begin          | A         |       40574 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_end_index            |            1 | end            | A         |       40574 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_traStat_index        |            1 | traStat        | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_invStat_index        |            1 | invStat        | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_patient_index        |            1 | patient        | A         |       40574 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_provider_index       |            1 | provider       | A         |          34 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_biller_index         |            1 | biller         | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_name_index           |            1 | name           | A         |       40574 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_law_index            |            1 | law            | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_reason_index         |            1 | reason         | A         |          25 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_amtPrepaid_index     |            1 | amtPrepaid     | A         |          73 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_amtPaid_index        |            1 | amtPaid        | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_amtPaidDirect_index  |            1 | amtPaidDirect  | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_amtFee_index         |            1 | amtFee         | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_invoiceType_index    |            1 | invoiceType    | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_invoiceOptimal_index |            1 | invoiceOptimal | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_patientCopy_index    |            1 | patientCopy    | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_diagnoses_index      |            1 | diagnoses      | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_customerNumber_index |            1 | customerNumber | A         |          25 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_traStatDate_index    |            1 | traStatDate    | A         |       40574 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_invStatDate_index    |            1 | invStatDate    | A         |       40574 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_oldInvoiceNr_index   |            1 | oldInvoiceNr   | A         |          19 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_cancReqFlag_index    |            1 | cancReqFlag    | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_cancReqDate_index    |            1 | cancReqDate    | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_claimNr_index        |            1 | claimNr        | A         |          19 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_claimReqFlag_index   |            1 | claimReqFlag   | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_claimReqDate_index   |            1 | claimReqDate   | A         |          19 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_depReqFlag_index     |            1 | depReqFlag     | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_depReqDate_index     |            1 | depReqDate     | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_cancRemarks_index    |            1 | cancRemarks    | A         |        2386 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_depRemarks_index     |            1 | depRemarks     | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_p02InvNr_index       |            1 | p02InvNr       | A         |       40574 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_p02InvDate_index     |            1 | p02InvDate     | A         |       40574 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_newInvoiceNr_index   |            1 | newInvoiceNr   | A         |        4508 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_mandator_index       |            1 | mandator       | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_account_index        |            1 | account        | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_invoiceDate_index    |            1 | invoiceDate    | A         |       40574 |     NULL | NULL   | YES  | BTREE      |         |               |
| invoiceBase |          1 | invoiceBase_debMngmt_index       |            1 | debMngmt       | A         |           3 |     NULL | NULL   | YES  | BTREE      |         |               |
+-------------+------------+----------------------------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

EXPLAIN on "new db"
explain SELECT
    b.tariff as tariff, b.benefitType as benefitType, b.name as name, b.code as code, SUM(b.effQuantPckType) as `count`,
    SUM(effCalcAmtVat) as `amount`,
    SUM(effAmt) as `amountAL`, SUM(effAmt2) as `amountTL`
FROM
    benefitCombined AS b
    LEFT OUTER JOIN invoice AS inv ON inv.id = b.invoice
WHERE
    (invoicePart != 'aaaaaaaaaaaaaaaaaaaa' OR invoice != 'aaaaaaaaaaaaaaaaaaaa') AND
    executingDoctor = 'dqwjvgbskiaaaacsonmj' AND b.begin >= '2018-06-16 00:00:00' AND
    b.begin <= '2018-07-16 23:59:57' AND 1=1
GROUP BY
    benefitType, code;

+------+--------------+---------------+------+---------------+------+---------+------+--------+----------------------------------------------+
| id   | select_type  | table         | type | possible_keys | key  | key_len | ref  | rows   | Extra                                        |
+------+--------------+---------------+------+---------------+------+---------+------+--------+----------------------------------------------+
|    1 | PRIMARY      | <derived2>    | ALL  | NULL          | NULL | NULL    | NULL | 281550 | Using where; Using temporary; Using filesort |
|    2 | DERIVED      | benefitBase   | ALL  | NULL          | NULL | NULL    | NULL | 281549 | Using where                                  |
|    3 | UNION        | benefitTarmed | ALL  | NULL          | NULL | NULL    | NULL |      1 | Using where                                  |
| NULL | UNION RESULT | <union2,3>    | ALL  | NULL          | NULL | NULL    | NULL |   NULL |                                              |
+------+--------------+---------------+------+---------------+------+---------+------+--------+----------------------------------------------+
7 rows in set (5.53 sec)

SHOW CREATE on "new db":
Identical to "old db".
I've done an "analyze table" on all tables / dbs on "new db" and also tried setting the same optimizer_switches, but the execution plan doesn't seem to change. mariadb.com mentions that "For all practical purposes, MariaDB is a binary drop in replacement of the same MySQL version...". My goal is to make the query execute at the same speed (at least) on "new db". I am looking for an explanation for the difference in the plans show above.
Edit: I've added index / view creation info, but the character limit is reached. The indexes show a difference in cardinality only, eg:
benefitBase_owner_index (old db: 233, new db: 17)
invoiceBase_newInvoiceNr_index (old db: 4647, new db: 1)

A: After setting the optimizer_switch (in this case 'table_elimination=on' was to blame for the difference in the execution plan) in the mariadb config file the execution plan changed and now resembles the one seen from 'old db' :
+------+--------------+---------------+--------+---------------+------+---------+-----------+--------+----------------------------------------------+
| id   | select_type  | table         | type   | possible_keys | key  | key_len | ref       | rows   | Extra                                        |
+------+--------------+---------------+--------+---------------+------+---------+-----------+--------+----------------------------------------------+
|    1 | PRIMARY      | <derived2>    | ALL    | NULL          | NULL | NULL    | NULL      | 306922 | Using where; Using temporary; Using filesort |
|    1 | PRIMARY      | invoiceBase   | eq_ref | id            | id   | 20      | b.invoice |      1 | Using where; Using index                     |
|    2 | DERIVED      | benefitBase   | ALL    | NULL          | NULL | NULL    | NULL      | 306921 | Using where                                  |
|    3 | UNION        | benefitTarmed | ALL    | NULL          | NULL | NULL    | NULL      |      1 | Using where                                  |
| NULL | UNION RESULT | <union2,3>    | ALL    | NULL          | NULL | NULL    | NULL      |   NULL |                                              |
+------+--------------+---------------+--------+---------------+------+---------+-----------+--------+----------------------------------------------+

I expected a change in execution time but the query still clocks in at about 6 seconds on a considerably faster (concerning CPU) host. As there might have been a difference in I/O speed or latency, i've mounted the tmpdir (which is used for writing the disk-bound temp tables) as a ramdisk, but there was no significant change in execution speed.

A: Why did it change between versions?  Did the phase of the moon change?  I am only half joking.  EXPLAIN depends on "statistics" that are approximate.  Probably what happened is that the stats changed, leading to a different query plan.  And, since the Optimizer is not perfect, perhaps it misread the stats and picked the wrong index (or whatever).
5.5.54 is long after development ceased on 5.5; only critical bugs were being fixed.  So, I don't believe any deliberate changes were made in the Optimizer, only bug fixes.
Please learn the benefits of "composite" indexes.
  AND executingDoctor = 'dqwjvgbskiaaaacsonmj'
  AND b.begin >= '2018-06-16 00:00:00' AND
      b.begin <= '2018-07-16 23:59:57'

begs for
INDEX(executingDoctor, `begin`)  -- in this order

This is assuming executingDoctor is in b.  Please qualify all columns when using a JOIN.  And provide SHOW CREATE TABLE.
Caveat: since a VIEW is involved, it may not be possible to make such an index and/or it may not get used.
Having dozens of indexes is usually a waste.  It is extremely likely that none of the indexes with Cardinality=1 will ever be used.  DROP them.  And probably those will 'small' cardinality are also unused.
VIEWs are still somewhat in their infancy in MySQL, especially back in 5.5.  Views are syntactic sugar around SELECTs and provide no performance benefit.  And sometimes they are not as well optimized.
For that kind of date range, consider
  AND b.begin >= '2018-06-16' AND
  AND b.begin  < '2018-06-16' + INTERVAL 1 MONTH

Hmmm... invoiceBase is in the first EXPLAIN but not in the second.  Did the query change?  Did the row(s) needed from that able vanish?  After all it is a LEFT JOIN.


text:
Q: PHP invalid JSON encoding I'm trying to GET a JSON format back when I POST a specific ID to my database. As I get more than one result I have multiple rows, which I want to get back. I do get different arrays back, but it is not a valid JSON Format. Instead of
[{...},{...},{...}]

it comes back as
{...}{...}{...}

Therefore the [...] are missing and the arrays are not separated by commas.
My code is down below. The function "getUserBookingsKl" is defined in a different php.
//get user bookings
public function getUserBookingsKl($id) {

    //sql command
    $sql = "SELECT * FROM `***` WHERE `hf_id`=$id AND `alloc_to`>DATE(NOW()) AND NOT `confirmation`=0000-00-00 ORDER BY `alloc_from`";

    //assign result we got from $sql to $result var
    $result = $this->conn->query($sql);

    // at least one result
    if ($result !=null && (mysqli_num_rows($result) >= 1 ))
    {
        while ($row = $result->fetch_array())
        {
            $returArray[] = $row;

        }
    }

    return $returArray;
}

...
...

foreach($userdb as $dataset)
    {
        $returnArray["group"] = $dataset["kf_id"];
        $returnArray["from"] = $dataset["alloc_from"];
        $returnArray["to"] = $dataset["alloc_to"];

       echo json_encode($returnArray);
     #   return;
    }

    // Close connection after registration
    $access->disconnect();

A: It looks like you're sequentially emitting the values, not pushing into an array. You need to make an array, push into it, then call json_encode on the resulting structure:
$final = [ ];
foreach ($userdb as $dataset)
{
  $returnArray = [ ];
  $returnArray["group"] = $dataset["kf_id"];
  $returnArray["from"] = $dataset["alloc_from"];
  $returnArray["to"] = $dataset["alloc_to"];

  $final[] = $returnArray;
}
echo json_encode($final);

Note that it's important here to not use the same variable inside the loop each time through or you're just pushing the same array in multiple times.


text:
Q: Redirecting subsite on same domain to other IIS using HTTPS I've seen many similar questions (and answers) on this subject, but none seem to be on exactly the same situation I am facing. Which is weird since I don't think it is that special, so forgive me if I haven't searched enough.
Anyway.
I have two websites which are on two IIS7, one facing WAN and one in the LAN. The WAN facing is already HTTPS-only.
I want to add the second website, but on the same HTTPS domain and SSL certificate, so that it becomes a subsite like: https://www.domain.com/subsite
How can I do a redirect or rewrite on the first IIS to the second one to make this work?
I don't think there is a standard IIS feature that can do this.
ISA server is not an option currently. But maybe another extension to IIS exists?
Done this numerous times on Apache, and am about to ditch IIS for Apache.

A: This is possible in IIS using the supported plugins ARR and URLrewrite. They install as integrated tools in the IIS Manager GUI.
If you install the latest ARR package you get URLrewrite bundled. The online documentation is somewhat lacking, but with a bit of tinkering what you want to do is achievable without too much hassle.
Even if the gui is quite friendly, my suggestion is to make sure you regularly save your applicationHost.config while testing, as the gui occasionally bugs out. This is true at least with ARR v2.5 which was the one I used when doing this. Then you have working text configs which you can copy/paste from each time you decide to clean-slate your config. This will save you a lot of time.
In the applicationHost.Config look especially for these XML elements:
<rewrite>
...
</rewrite>
<webFarms>
...
</webFarms>

The webfarms section is where your content locations defined in the gui end up, it is essentially config for a reverse-proxy load-balancer where a farm is a virtual service connection to one or more backend nodes. Similarly, the rewrite section is where you find your conditions for which content is to be fetched from which farm.
Here follows an actual configuration excerpt which does not match your use case entirely but which may serve as inspiration regardless. Possibly you only need to edit the second rewrite rule to match your scenario. The use case presented is for when the IIS is used as a pass-through proxy to two backend farms, dynamic content is served from the "htmlFarm", whilst requests for predefined static content such as images from the "imageFarm".
The selection is done based on the beginning of the URI. If the URI starts with /images/ it is regarded as static content and routed to "imageFarm", else it is routed to "htmlFarm". In either case the IIS is presenting itself to the client as the one and only web server. A simple health check is also done in two different ways, one for each farm. This was just by way of experiment and I just include it as residual noise which nevertheless could be of use to you.
<rewrite>
        <globalRules>
            <clear />
            <rule name="Route all to htmlFarm" patternSyntax="ECMAScript">
                <match url=".*" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{HTTP_HOST}" pattern="(.*\.)?site01.com" />
                </conditions>
                <action type="Rewrite" url="http://htmlFarm/{R:0}" />
            </rule>
            <rule name="Route /images/* to imageFarm" stopProcessing="false">
                <match url="images/.*" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                <action type="Rewrite" url="http://imageFarm/{R:0}" />
            </rule>

        </globalRules>
</rewrite>
....
<webFarms>
    <webFarm name="htmlFarm" enabled="true">
        <server address="192.168.50.77" enabled="true">
            <applicationRequestRouting weight="100" />
        </server>
        <server address="192.168.50.78" enabled="true" />
        <applicationRequestRouting>
            <loadBalancing algorithm="WeightedRoundRobin" />
            <healthCheck url="http://site01.com" responseMatch="Testing" />
        </applicationRequestRouting>
    </webFarm>
    <webFarm name="imageFarm" enabled="true">
        <server address="192.168.50.81" enabled="true">
            <applicationRequestRouting weight="100" />
        </server>
        <server address="192.168.50.82" enabled="true">
            <applicationRequestRouting weight="100" />
        </server>
        <applicationRequestRouting>
            <healthCheck url="http://site01.com/images/test.txt" responseMatch="WillTest" />
            <loadBalancing algorithm="WeightedRoundRobin" />
        </applicationRequestRouting>
    </webFarm>
    <applicationRequestRouting>
        <hostAffinityProviderList>
            <add name="Microsoft.Web.Arr.HostNameRoundRobin" />
            <add name="Microsoft.Web.Arr.HostNameMemory" />
        </hostAffinityProviderList>
    </applicationRequestRouting>
</webFarms>

Again not in your use case but nevertheless: a limitation in ARR is that even though an IIS node with ARR can provide redundancy for the backend, it will in itself be a single point of failure. You need two or more identically configured IIS/ARR nodes with NLB, or a separate load balancer in front in order to overcome this. Web-fronts-as-usual in other words :-)
We ultimately ditched IIS/ARR for Apache, but more by way of political accident which caused a major outbreak of office humour. I really don´t favour either above the other as I find both to function and perform very, very well. Monitoring in Apache however is abysmal in direct comparison with IIS, and in no way do I wish that comment to be a flame to anything. It´s just my direct experience with all respect to other possibly differing opinions on the subject.
Best of luck!


text:
Q: How to unit test standalone Vue composition I have a setup similar as the example in the docs where my composition lives in a separate file from my component as follows:
// composition.js
import { onMounted } from '@vue/composition-api';

export default function useComposition() {
  onMounted(() => {
    console.log('Hello, world!');
  });
}

// component.vue
<template>...</template>

<script>
import { createComponent } from '@vue/composition-api';

export default createComponent({
  setup() {
    useComposition();
  }
})
</script>

I would like to write a separate (Jest based) test file for just the composition.js file. However, when calling the composition directly, Vue will error out (expectedly):
// composition.test.js

import useComposition from './composition';

describe('Composition', () => {
  it('Works', () => {
    useComposition();
    // Error: [vue-composition-api] "onMounted" get called outside of "setup()"
  });
});

I've tried mounting a mock composition API based component in order to provide a setup() function, but having some trouble getting it to work:
import { mount, createLocalVue } from '@vue/test-utils';
import VueCompositionAPI, { createComponent } from '@vue/composition-api';
import useComposition from './composition';

const localVue = createLocalVue();
localVue.use(VueCompositionAPI);

describe('Composition', () => {
    it('Works', () => {
        const mockComponent = createComponent({
            setup() {
                useComposition();

                return h => h('div');
            }
        });

        mount(mockComponent, { localVue });
        // [Vue warn]: Failed to mount component: template or render function not defined.
    });
});

Does anybody have any bright ideas on how to get this to work so I can write tests for my modular compositions?

A: The error [Vue warn]: Failed to mount component: template or render function not defined. is caused by the fact that @vue/composition-api doesn't have support for returning the render function in the setup function. With that knowledge, I was able to create a valid mock component render function. The following seems to work as expected:
import VueCompositionAPI from '@vue/composition-api';
import { mount, createLocalVue } from '@vue/test-utils';

const localVue = createLocalVue();
localVue.use(VueCompositionAPI);

const mountComposition = (cb: () => any) => {
    return mount(
        {
            setup() {
                return cb();
            },
            render(h) {
                return h('div');
            }
        },
        { localVue }
    );
};

describe('My Test', () => {
    it('Works', () => {
        let value;

        const component = mountComposition(() => {
            value = useComposition();
        });

        expect(value).toBe(true);
    });
});


text:
Q: Why does jquery UI not render select boxes properly I have a simple select box:
<select id="targetDept" name="targetDept" class="ui-select" onclick="clearApprovers()">
<option value="1">blah</option>
<option value="2">blah2</option>
<option value="3">blah3</option>
<option value="4">blah4</option>
</select>

I try to make it into a fancy jquery select box:
$(document).ready(function () {

    $(".ui-select").selectmenu();
    $(".ui-button").button();

});

Here are my includes:
<link rel="stylesheet" href="js/jquery-ui-1.11.4/jquery-ui.theme.css">
        <script type="text/javascript" src="js/jquery-2.1.4.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.11.4/jquery-ui.js"></script>

It works but it makes the select into the most ugly thing. Unfortunately, because of company computer policies, I cant upload a picture so i will try to describe it.
The dropdow itself is essentially a button and the left and right padding is 0 (ie the text is touching the border of the "button"). When I click on the dropdown, it opens a SUPER wide span, that is about 3 times the width of my actual page, creating a scroll bar along the bottom. Each option is beside a big black bullet point and clicking an option does not select it, leaving the options open and not really doing anything...
I know it's not easy to diagnose, but thanks ahead of time.

A: It sounds like you are missing the jquery-ui core css file. If you downloaded the zip file from the Jquery homepage it's in the root folder called jquery-ui.css.
The theme file only provides the colours - not the base styling needed to make it function correctly.

A: Have you included all the css file from jquery-ui package? Because jquery-ui.theme.css is just a theme of jquery-ui.css.


text:
Q: bash: silently kill background function process shell gurus,
I have a bash shell script, in which I launch a background function, say foo(), to display a progress bar for a boring and long command:
foo()
{
    while [ 1 ]
    do
        #massively cool progress bar display code
        sleep 1
    done
}

foo &
foo_pid=$!

boring_and_long_command
kill $foo_pid >/dev/null 2>&1
sleep 10

now, when foo dies, I see the following text:
/home/user/script: line XXX: 30290 Killed                  foo

This totally destroys the awesomeness of my, otherwise massively cool, progress bar display.
How do I get rid of this message?

A: kill $foo_pid
wait $foo_pid 2>/dev/null

BTW, I don't know about your massively cool progress bar, but have you seen Pipe Viewer (pv)?  http://www.ivarch.com/programs/pv.shtml

A: Try to replace your line kill $foo_pid >/dev/null 2>&1 with the line:
(kill $foo_pid 2>&1) >/dev/null

Update:
This answer is not correct for the reason explained by @mklement0 in his comment:

The reason this answer isn't effective with background jobs is that
  Bash itself asynchronously, after the kill command has completed,
  outputs a status message about the killed job, which you cannot
  suppress directly - unless you use wait, as in the accepted answer.

A: This "hack" seems to work:
# Some trickery to hide killed message
exec 3>&2          # 3 is now a copy of 2
exec 2> /dev/null  # 2 now points to /dev/null
kill $foo_pid >/dev/null 2>&1
sleep 1            # sleep to wait for process to die
exec 2>&3          # restore stderr to saved
exec 3>&-          # close saved version

and it was inspired from here. World order has been restored.

A: This is a solution I came up with for a similar problem (wanted to display a timestamp during long running processes). This implements a killsub function that allows you to kill any subshell quietly as long as you know the pid. Note, that the trap instructions are important to include: in case the script is interrupted, the subshell will not continue to run.
foo()
{
    while [ 1 ]
    do
        #massively cool progress bar display code
        sleep 1
    done
}

#Kills the sub process quietly
function killsub()
{

    kill -9 ${1} 2>/dev/null
    wait ${1} 2>/dev/null

}

foo &
foo_pid=$!

#Add a trap incase of unexpected interruptions
trap 'killsub ${foo_pid}; exit' INT TERM EXIT

boring_and_long_command

#Kill foo after finished
killsub ${foo_pid}

#Reset trap
trap - INT TERM EXIT

A: Just came across this myself, and realised "disown" is what we are looking for.
foo &
foo_pid=$!
disown

boring_and_long_command
kill $foo_pid
sleep 10

The death message is being printed because the process is still in the shells list of watched "jobs". The disown command will remove the most recently spawned process from this list so that no debug message will be generated when it is killed, even with SIGKILL (-9).

A: Add at the start of the function:
trap 'exit 0' TERM

A: You can use set +m before to suppress that. More information on that here

A: Another way to do it:
    func_terminate_service(){

      [[ "$(pidof ${1})" ]] && killall ${1}
      sleep 2
      [[ "$(pidof ${1})" ]] && kill -9 "$(pidof ${1})"

    }

call it with
    func_terminate_service "firefox"

A: Yet another way to disable job notifications is to put your command to be backgrounded in a sh -c 'cmd &' construct.
#!/bin/bash

foo()
{
   while [ 1 ]
   do
       sleep 1
   done
}

#foo &
#foo_pid=$!

export -f foo
foo_pid=`sh -c 'foo & echo ${!}' | head -1`

# if shell does not support exporting functions (export -f foo)
#arg1='foo() { while [ 1 ]; do sleep 1; done; }'
#foo_pid=`sh -c 'eval "$1"; foo & echo ${!}' _ "$arg1" | head -1`

sleep 3
echo kill ${foo_pid}
kill ${foo_pid}
sleep 3
exit

A: The error message should come from the default signal handler which dump the signal source in the script. I met the similar errors only on bash 3.x and 4.x. To always quietly kill the child process everywhere(tested on bash 3/4/5, dash, ash, zsh), we could trap the TERM signal at the very first of child process:
#!/bin/sh

## assume script name is test.sh

foo() {
  trap 'exit 0' TERM ## here is the key
  while true; do sleep 1; done
}

echo before child
ps aux | grep 'test\.s[h]\|slee[p]'

foo &
foo_pid=$!

sleep 1 # wait trap is done

echo before kill
ps aux | grep 'test\.s[h]\|slee[p]'

kill $foo_pid

sleep 1 # wait kill is done

echo after kill
ps aux | grep 'test\.s[h]\|slee[p]'


text:
Q: Java EE Persistence WELD-001408 when deploying on wildfly I have a problem, when I want to deploy my application on wildfly.
This is my persistence:
<persistence-unit name="jws" transaction-type="JTA">
    <class>lv.lavloz.merrill.generator.v1.model.ID</class>
    <jta-data-source>java:jboss/datasources/MySQL/JWSDS</jta-data-source>
    <properties>
        <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
    </properties>
</persistence-unit>

The connection url for the jndi java:jboss/datasources/MySQL/JWSDS is jdbc:mysql://localhost:3306/db.
And this is the ejb :
@Stateless
public class GeneratorBean {
    @PersistenceContext(unitName = "jws")
    private EntityManager em;
...
}

When I want to deploy my application to wildfly, I get the error message
java.lang.Exception: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"jws_ear.ear\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jws_ear.ear\".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ParamConverterFactory with qualifiers @Default
  at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public org.glassfish.jersey.server.internal.inject.MultivaluedParameterExtractorFactory(ParamConverterFactory)
  at org.glassfish.jersey.server.internal.inject.MultivaluedParameterExtractorFactory.<init>(MultivaluedParameterExtractorFactory.java:0)
WELD-001474: Class org.glassfish.jersey.server.internal.inject.ParamConverterFactory is on the classpath, but was ignored because a class it references was not found: org.glassfish.hk2.api.ServiceLocator from [Module \"deployment.jws_ear.ear:main\" from Service Module Loader].
"}}

What to do?

A: This does not seem to be related to JPA at all.
Your error message referring to org.glassfish.jersey.server.internal indicates that your application has a dependency on Jersey.
Are you trying to port an application from GlassFish to WildFly? If so, you should eliminate all dependencies on Jersey and only use the JAX-RS APIs, or WildFly's JAX-RS implementation RESTEasy.
Jersey is not contained in WildFly.


text:
Q: Dynamically add BoxViews to Grid [Xamarin.Forms] I am trying to add BoxViews in a Grid format using 3 columns and multiple rows. I have defined the grid using xaml and the behaviour
in the c# file. What should happen is a BoxView should be created for the same number of images with 3 images per column.
Thanks,
XAML
<Grid RowSpacing="0" x:Name="scrollBarGrid">
    <Grid.RowDefinitions>
        <RowDefinition Height="50"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!--Where the search bar will go-->
    <BoxView BackgroundColor="Aqua" Grid.Row="0"/>

        <SearchBar ></SearchBar>

        <!--Where the images will go-->
    <BoxView BackgroundColor="Gray" Grid.Row="1"/>
    <Grid x:Name="imageGrid" RowSpacing="0" Grid.Row="1">

    </Grid>

</Grid>

C#
public MainPage()
    {
        InitializeComponent();

        int colMaximum = 3;
        int numberOfImages = 15;

        //To add three columns
        for (int i = 0; i < colMaximum; i++)
        {
            imageGrid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(120, GridUnitType.Absolute)
            });
        }

        //To add an array of rows
        imageGrid.RowDefinitions = new RowDefinitionCollection();

        for (int myCount = 0; myCount <= numberOfImages / colMaximum; myCount++)
        {
            imageGrid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(120, GridUnitType.Absolute)
            });

            //To add a new box view for each
            for (int newcol = 0; newcol <= colMaximum; newcol++)
            {
                for (int newrow = 0; newrow <= numberOfImages / colMaximum; newrow++)
                {
                    imageGrid.Children.Add(new BoxView() { BackgroundColor = Color.Red });
                }
            }
        }
    }

A: When you add children to a grid, you have to specify the Row and Col, otherwise they will be added at 0,0.
  imageGrid.Children.Add(new BoxView() { BackgroundColor = Color.Red }, newrow, newcol);


text:
Q: Carry over long sequence of missing values with Postgres I have a table like this:
create table foo (foo_label text, foo_price int, foo_date date);

insert into foo (
          values
          ('aaa', 100,  '2017-01-01'),
          ('aaa', NULL, '2017-02-01'),
          ('aaa', NULL, '2017-03-01'),
          ('aaa', NULL, '2017-04-01'),
          ('aaa', 140,  '2017-05-01'),
          ('aaa', NULL, '2017-06-01'),
          ('aaa', 180,  '2017-07-01')
        );

As you can see a few values on the foo_price column are missing.
What I need is that missing values get filled up with the "previous" available value in this way:
 foo_label | fixed_foo_price | foo_date
-----------+-----------------+------------
 aaa       | 100             | 2017-01-01
 aaa       | 100             | 2017-02-01
 aaa       | 100             | 2017-03-01
 aaa       | 100             | 2017-04-01
 aaa       | 140             | 2017-05-01
 aaa       | 140             | 2017-06-01
 aaa       | 180             | 2017-07-01

My attempt:
select
    foo_label,
    (case when foo_price is null then previous_foo_price else foo_price end) as fixed_foo_price,
    foo_date
from (
  select
      foo_label,
      lag(foo_price) OVER (PARTITION BY foo_label order by foo_date::date) as previous_foo_price,
      foo_price,
      foo_date
      from foo
) T;

As you can see from here:
https://www.db-fiddle.com/#&togetherjs=s6giIonUxT
It doesn't fill completely the '100' series.
Any idea how can I get the wanted result?

A: Backfill missing data in postgresql walkthrough demo
Create a table called my_money with an index, numeric with nulls, and a date then insert some rows.
drop table if exists my_money;
CREATE TABLE my_money ( tick     character varying(10),
                        cci_val  numeric(5,2),
                        date_val date);
insert into my_money values('BTC', 35.3, '2021-10-10');
insert into my_money values('BTC', null, '2021-10-9');
insert into my_money values('BTC',  9.9, '2021-10-8');
insert into my_money values('BTC', null, '2021-10-7');
insert into my_money values('BTC', null, '2021-10-6');
insert into my_money values('BTC',  3.0, '2021-10-5');
insert into my_money values('BTC', null, '2021-10-4');
select * from my_money;
┌──────┬─────────┬────────────┐
│ tick │ cci_val │  date_val  │
├──────┼─────────┼────────────┤
│ BTC  │   35.30 │ 2021-10-10 │
│ BTC  │       ¤ │ 2021-10-09 │   <-- want 9.90 to fill here.
│ BTC  │    9.90 │ 2021-10-08 │
│ BTC  │       ¤ │ 2021-10-07 │   <-- want 3.00 to fill here.
│ BTC  │       ¤ │ 2021-10-06 │   <-- want 3.00 to fill here.
│ BTC  │    3.00 │ 2021-10-05 │
│ BTC  │       ¤ │ 2021-10-04 │   <-- want a default begin val to fill here.
└──────┴─────────┴────────────┘

Make a temporary table to construct our backfilled column named:  backfilled_cci_val
drop table if exists my_money2;
CREATE TABLE my_money2 as (
    SELECT tick, cci_val,
        first_value(cci_val) OVER (
        PARTITION BY tick, grp ORDER BY date_val) AS backfilled_cci_val,
        date_val
    FROM (
        SELECT tick,
        count(cci_val) OVER (PARTITION BY tick ORDER BY date_val) AS grp,
        cci_val, date_val
        FROM   my_money where tick = 'BTC'
    ) sub order by date_val desc
);
select * from my_money2;
┌──────┬─────────┬────────────────────┬────────────┐
│ tick │ cci_val │ backfilled_cci_val │  date_val  │
├──────┼─────────┼────────────────────┼────────────┤
│ BTC  │   35.30 │              35.30 │ 2021-10-10 │
│ BTC  │       ¤ │               9.90 │ 2021-10-09 │
│ BTC  │    9.90 │               9.90 │ 2021-10-08 │
│ BTC  │       ¤ │               3.00 │ 2021-10-07 │
│ BTC  │       ¤ │               3.00 │ 2021-10-06 │
│ BTC  │    3.00 │               3.00 │ 2021-10-05 │
│ BTC  │       ¤ │                  ¤ │ 2021-10-04 │  <-- set a default value
└──────┴─────────┴────────────────────┴────────────┘

So far so good but we can't backfill the first null, because there it has no prior, so you'll have to decide a default begin value manually with an update:
update my_money2 set backfilled_cci_val = -1
where tick = 'BTC'
and backfilled_cci_val is null;
select * from my_money2;
┌──────┬─────────┬────────────────────┬────────────┐
│ tick │ cci_val │ backfilled_cci_val │  date_val  │
├──────┼─────────┼────────────────────┼────────────┤
│ BTC  │   35.30 │              35.30 │ 2021-10-10 │
│ BTC  │       ¤ │               9.90 │ 2021-10-09 │
│ BTC  │    9.90 │               9.90 │ 2021-10-08 │
│ BTC  │       ¤ │               3.00 │ 2021-10-07 │
│ BTC  │       ¤ │               3.00 │ 2021-10-06 │
│ BTC  │    3.00 │               3.00 │ 2021-10-05 │
│ BTC  │       ¤ │                 -1 │ 2021-10-04 │
└──────┴─────────┴────────────────────┴────────────┘

Final step is to substitute the backfilled_cci_val from the new table back into cci_val from the original table:
update my_money set cci_val = backfilled_cci_val
from my_money2 where my_money.date_val = my_money2.date_val;
select * from my_money;
┌──────┬─────────┬────────────┐
│ tick │ cci_val │  date_val  │
├──────┼─────────┼────────────┤
│ BTC  │   35.30 │ 2021-10-10 │
│ BTC  │    9.90 │ 2021-10-09 │
│ BTC  │    9.90 │ 2021-10-08 │
│ BTC  │    3.00 │ 2021-10-07 │
│ BTC  │    3.00 │ 2021-10-06 │
│ BTC  │    3.00 │ 2021-10-05 │
│ BTC  │   -1.00 │ 2021-10-04 │
└──────┴─────────┴────────────┘

Alternatively, if you like to live dangerously and backfill one-shot and in-place:
This update statement does the same as all the above, except does it inplace on the existing table.
update my_money f1 set cci_val = backfilled_cci_val from (
    SELECT tick,
    cci_val,
    first_value(cci_val) OVER
        (PARTITION BY tick, grp ORDER BY date_val) AS backfilled_cci_val,
    date_val
    FROM (
        SELECT tick,
        count(cci_val) OVER (PARTITION BY tick ORDER BY date_val) AS grp,
        cci_val, date_val
        FROM   my_money where tick = 'BTC'
    ) sub order by date_val desc
) f2 where f1.date_val = f2.date_val and f1.tick = 'BTC' and f1.tick = f2.tick;
update my_money set cci_val = -1 where tick = 'BTC' and cci_val is null;

Which produces the same final result explained above.

A: I would form groups with the window function count() and then take the first value for each group:
SELECT foo_label
     , first_value(foo_price) OVER (PARTITION BY foo_label, grp ORDER BY foo_date) AS fixed_foo_price
     , foo_date
FROM  (
   SELECT foo_label
        , count(foo_price) OVER (PARTITION BY foo_label ORDER BY foo_date) AS grp
        , foo_price
        , foo_date
   FROM   foo
   ) sub;

This works because count() only counts non-null values. So all rows with NULL end up in the same group as the last row with an actual value. Exactly what you need.
Leading NULL values (effectively group "0") end up with NULL. Add a default with COALESCE if you want. For instance to fill in 0 instead of NULL:
     , COALESCE(first_value(foo_price) OVER (...), 0) AS fixed_foo_price


text:
Q: PHP mailer Character encoding issue I m facing some character encoding issues like this:
D\\\'Huison-Longueville Référence

Original Text was :
D'Huison-Longueville Référence

Here is my PHP Mailer script:
                 $mail = new PHPMailer();
                 $mail->CharSet = 'UTF-8';
                 $mail->IsMail();
                 $mail->Subject = $subject;
                 $mail->IsHTML(true);
                 $mail->Body = $email_body;
                 $mail->From='support@xyz.com';
                 $mail->FromName= "Support Team";
                 $mail->AddAddress($toEmail);
                 $mail->Send();

A: I had the same problem. The charset was not being changed although I was specifying the new one like you with:
$mail->CharSet = 'UTF-8';

Since you use "IsMail" you have to go to the folder where class.phpmailer.php resides (generally in the same folder as the main phpmailer.php file) and edit it. There you will see the default values for the mail and you will see that it is set to "ISO-8859-1".
Change
public $CharSet = 'ISO-8859-1';

to
public $CharSet = 'UTF-8';

Change it to "UTF-8" or any other charset you want.


text:
Q: Passing numeric element to object I am working on a NodeJS addon project and i couldn't really understand how to pass a long value into my object.
Here is my code:
#include <node.h>
namespace NODEAPP
{
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::String;
using v8::Value;
using v8::Handle;
void fooFunc(const FunctionCallbackInfo<Value>& args)
{
    long foo = 51294;
    long bar = 91923;
    Isolate* isolate = args.GetIsolate();
    Local<Object> obj = Object::New(isolate);
    obj->Set(String::NewFromUtf8(isolate, "msg"), wanna pass foo here);
    args.GetReturnValue().Set(obj);
}
}

Thanks in advance

A: I found out.
Here it is:
obj->Set(String::NewFromUtf8(isolate, "msg"), v8::Integer::New(isolate, foo));


text:
Q: Google AdSense does not resize when window size gets changed Here is a related post from 2014: Responsive Adsense ad resizing with screen orientation change (while using Bootstrap for layout)
It looks like the resizing feature was beta then but it's 2015.
The challenge is the same:

*

*Open a window with responsive AdSense -> AdSense adopts itself to the size

*Resize the window -> AdSense does not request a new version.

Now the docs on responsive resizing have been updated by google (source: https://support.google.com/adsense/answer/3213689?hl=en)
They state:

Support for ad size changes after a screen orientation change. If your responsive page changes its layout following a device orientation change (e.g., when a tablet or phone goes from portrait to landscape), we'll request and load a new ad of the correct dimensions to fit the new page layout.

Well, either I do not understand it, or it does not work. Shouldn't this be working when I change the size of my window? Bootstraps responsive grid does so.
I am aware of various workarounds like media queries, reloading the js, having multiple ads for multiple sizes, but then the statement above does not make sense.
Do they really only include going fro portrait to landscape? How is this issued in the browser?
Edit: I do not have an advanced responsive ad, just a plain one, no customization of size or shape.
Edit2: The container in which the ad is, does change it's size based on bootstrap's media queries, so AdSense should always be able to determine the dimension of the ad.


text:
Q: ggsurvplot changing confidence interval line size Trying to change the line size of my confidence interval using ggsurvplot. When I use change the size to 1 or 2, it only affects the size of the center line, and not the size of the confidence interval lines. Any suggestions on how to alter the size of those lines?
Here is my code:
ggsurvplot(ovlsfit,
                  surv.scale="percent",
                  title="Survival Curve",
                  xlim=c(-0.02,5.1),
                  xlab=c("Time (y)"),
                  break.x.by=1,
                  censor=FALSE,
                  axes.offset=FALSE,
                  conf.int.style=c("step"),
                  legend=c("none"),
                  linetype = "strata",
                  color="black",
                  size=0.8,
                  risk.table=TRUE,
                  risk.table.height=0.18,
                  risk.table.pos=c("out"),
                  risk.table.fontsize=4)

And output:

A: Let's create a model similar to yours for demonstration:
library(survival)
library(survminer)

ovlsfit <- survfit(Surv(time/660, status) ~ 1, data = colon)

Now we will try to recreate your plot:
p <- ggsurvplot(ovlsfit,
                surv.scale = "percent",
                title = "Survival Curve",
                xlim = c(-0.02,5.1),
                xlab = c("Time (y)"),
                break.x.by = 1,
                censor = FALSE,
                axes.offset = FALSE,
                conf.int.style = c("step"),
                legend = c("none"),
                linetype = 'strata',
                palette = "black",
                size = 0.8,
                risk.table = TRUE,
                risk.table.height = 0.18,
                risk.table.pos = c("out"),
                risk.table.fontsize = 4)

p

Unfortunately, there is no direct access to the confidence interval line size from within the call to ggsurvplot, but we can easily access the layers they are in and change the line size directly. Here, we will make them large for demonstration purposes:
p$plot$layers[[3]]$aes_params$size <- 2
p$plot$layers[[4]]$aes_params$size <- 2

p


text:
Q: How to restart foreground service after app updating in Android Oreo? We need the foreground service of our application to be restarted after the application is automatically updated from Google Play. For SDK < 26 we registered the receiver on PACKAGE_REPLACED actoin and everything worked fine. How can we do the same thing in SDK 26 if implicit intents are forbidden? Thanks.

A: First, not all implicit broadcasts are banned. There is a whitelist.
Second, ACTION_MY_PACKAGE_CHANGED is an explicit broadcast, sent only to your app. Quoting the documentation:

Apps that target Android 8.0 or higher can no longer register broadcast receivers for implicit broadcasts in their manifest. An implicit broadcast is a broadcast that does not target that app specifically. For example, ACTION_PACKAGE_REPLACED is an implicit broadcast, since it is sent to all registered listeners, letting them know that some package on the device was replaced. However, ACTION_MY_PACKAGE_REPLACED is not an implicit broadcast, since it is sent only to the app whose package was replaced, no matter how many other apps have registered listeners for that broadcast.

So, you should be able to register for ACTION_MY_PACKAGE_REPLACED, and restart your service there.


text:
Q: Does a group morphism factor through a quotient group? I'm about to solve 3 exercice sierge lang algebra third edition:

Let $G^c$ be the sub-group generated by commutator. Question: Show that $G^c$ is normal sub-group of $G$ and show that every homomorphism of $G $ onto an abelian group $G^\prime $ factor through $G / G^c  $.

For the first one it is easy, but for the second this is my attempt:
Let $f:G \rightarrow G $ a group homomorphism and consider the canonical projection $\pi : G \rightarrow G^c $ by the first iso theorem there is a unique $\alpha$ s.t for all $g \in G$, $ \alpha (\pi (g))=f(g)$.


text:
Q: Why isn't this limit equal to $0$? $f(2)=4$, $g(2)=9$, $f'(2)=g'(2)$.
$ \displaystyle \lim_{x \to 2} \frac{ \sqrt{f(x)}-2} { \sqrt{g(x)}-2} $.
Why isn't this limit equal to $0$? Since $f$ and $g$ are differentiable at $x=2$, that means they are continuous, so you should be able to evaluate the limit by direct substitution. Thanks!

A: Substitution is perfectly appropriate, since the denominator does not evaluate to $0$. But I think you substituted $2 = f(x)$ instead of using $f(2) = 4$, and likewise, you substituted $g(x) =2$ instead of $g(2) = 9$.
$$\lim_{x\to 2} \frac{\sqrt{f(x) - 2}}{\sqrt{g(x) - 2}} = \frac {\sqrt{4 - 2}}{\sqrt{9-2}} = \sqrt{\frac{2}7}$$
ADDED: Even with the correction in formatting, substitution is perfectly appropriate to use, again, since the denominator does not evaluate to /approach $0$:
$$\lim_{x\to 2} \frac{\sqrt{f(x)} - 2}{\sqrt{g(x)} - 2} = \frac {\sqrt{4} - 2}{\sqrt{9} -2} = \frac{0}{1} = 0$$

A: You can evaluate by direct substitution provided that the function in the denominator does not approach 0 or infinity.
I'm kind of suspecting there is a typo in your OP concerning the square roots, but even if a minor modification is necessary to what is actually there, this should address your question.

A: The conditions given don't make much sense unless the limit you have to compute is
$$
\lim_{x\to 2}\frac{\sqrt{f(x)}-2}{\sqrt{g(x)}-3}
$$
where direct substitution is impossible. In this case the data about the derivatives allow you to use L'Hôpital's theorem and do
$$
\lim_{x\to 2}\frac{\sqrt{f(x)}-2}{\sqrt{g(x)}-3}
=
\frac{\dfrac{f'(2)}{2\sqrt{f(2)}}}{\dfrac{g'(2)}{2\sqrt{g(2)}}}
=
\frac{f'(2)}{4}\frac{6}{g'(2)}
=\frac{3}{2}
$$
with the further assumption that $f'(2)=g'(2)\ne0$. If the common value of the derivatives at $2$ is zero you can't say anything about the limit with the available information.
If the limit is really
$$
\lim_{x\to 2}\frac{\sqrt{f(x)}-2}{\sqrt{g(x)}-2}
$$
then it is $0$ by substituting.

A: Im not really sure how you are finding 2 f(2)=4 and g(2)=9 so f(2)-2= 4-2 and g(2)=9 2-9=7 so you have $(\frac {2}{7})^{1/2}$ no?

A: As written, $\displaystyle\lim_{x \to 2}\dfrac{\sqrt{f(x)-2}}{\sqrt{g(x)}-2}=\frac {\sqrt 2}1$ by direct substitution.  It would be zero, also by direct substitution, if the numerator were $\sqrt {f(x)}-2$


text:
Q: Django: DetailView and multiple slugs I have an issue with my DetailView. I want to make sure both values are in the url string and then want to display the page. However I am always receiving this error here:
KeyError at /orders/ticket/ug2dc78agz-1/d04fkjmo37/
'order_reference'

views.py
class TicketView(DetailView):
    model = Attendee
    template_name = 'orders/ticket_view.html'

    def get_queryset(self):
        return Attendee.objects.filter(
            order__order_reference=self.kwargs['order_reference'],
        ).filter(
            access_key=self.kwargs['access_key'],
        )

urls.py
urlpatterns = [
    path(
        'ticket/<slug:ticket_reference>/<slug:access_key>/',
        TicketView.as_view(),
        name='ticket'
    ),
]

A: You get the error because you are trying to access self.kwargs['order_reference'], but you don't use order_reference in the path().
Your path() uses,
'ticket/<slug:ticket_reference>/<slug:access_key>/'

therefore you can use self.kwargs['ticket_reference'] and self.kwargs['access_key'].
Since your path does not contain slug or pk, Django will not know how to fetch the object for the detail view. I would override get_object instead of get_queryset:
def get_object(self):
    return get_object_or_404(
        Attendee,
        order__order_reference=self.kwargs['slug:ticket_reference'],
        access_key=self.kwargs['access_key'],
    )

A: You have ticket_reference url variable, but in view using order_reference. You should rename it:
class TicketView(DetailView):
    model = Attendee
    template_name = 'orders/ticket_view.html'

    def get_queryset(self):
        return Attendee.objects.filter(
            order__order_reference=self.kwargs['ticket_reference'],
        ).filter(
            access_key=self.kwargs['access_key'],
        )