## Username password authentication doesnt work as expected im mosquitto broker

Authentication with username and password doesnt work as expected in mosquitto broker..I am able to subscribe mosquitto_sub and publish mosquitto_pub to topics even if the username and password is wrong!! could anyone help me!!

Mosquitto.conf file includes:

`allow_anonymous false `
`password_file path_to_the_file`
created a passwords file

Loaded the config file ` mosquitto -c path_to_the_config_file` and the config file reloads.

Reboot the system.

Is there anything else that needs to be done?

## oracle – ORA-00932: inconsistent datatypes: expected CHAR got NUMBER

I am trying to SUBSTR the first 3 character in use this query -> CASE WHEN (RMSTMP_PNG.ota_activity_lotinfo.KEY = ‘TestProgram’) THEN TO_CHAR(SUBSTR(RMSTMP_PNG.ota_activity_lotinfo.VALUE,1,3)) ELSE 0 END AS Test1
But it return me this ORA-00932: inconsistent datatypes: expected CHAR got NUMBER
00932. 00000 – “inconsistent datatypes: expected %s got %s”. May i know what wrong in my query? I tried to use To_NUMBER or To CHAR, it also return me same error. Appreciate if someone could help on this issue.
Below is my query:

``````SELECT RMSTMP_PNG.ota_activity.EQP_ID,
SUM(CASE WHEN (RMSTMP_PNG.ota_activity.MESSAGE='Load lot success.' AND RMSTMP_PNG.ota_activity_lotinfo.KEY = 'Quantity') THEN 1 ELSE 0 END) AS LOT_ID,
SUM(CASE WHEN (RMSTMP_PNG.ota_activity.MESSAGE='Load lot success.' AND RMSTMP_PNG.ota_activity_lotinfo.KEY = 'Quantity') THEN TO_NUMBER(RMSTMP_PNG.ota_activity_lotinfo.VALUE) ELSE 0 END) AS QUANTITY,
CASE WHEN (RMSTMP_PNG.ota_activity_lotinfo.KEY = 'TestProgram') THEN TO_CHAR(SUBSTR(RMSTMP_PNG.ota_activity_lotinfo.VALUE,1,3)) ELSE 0 END AS Test1
FROM RMSTMP_PNG.ota_activity
FULL OUTER JOIN RMSTMP_PNG.ota_activity_lotinfo ON RMSTMP_PNG.ota_activity.ID = RMSTMP_PNG.ota_activity_lotinfo.ID
WHERE RMSTMP_PNG.ota_activity.MODIFIED_DATE >= to_date('27-Sep-2020')
AND RMSTMP_PNG.ota_activity.MODIFIED_DATE < to_date('27-Sep-2020') + 1
group by RMSTMP_PNG.ota_activity.EQP_ID,RMSTMP_PNG.ota_activity_lotinfo.VALUE, RMSTMP_PNG.ota_activity_lotinfo.KEY
order by RMSTMP_PNG.ota_activity.EQP_ID
``````

## algorithms – Expected runtime for hashing with a binary search tree as collision handling

I thought about implementing a data structure with expected runtime of O(1) for insertion, deletion and look-up and a worst case runtime for these operations of O(log(n)). This is under the assumption of uniformly distributed data.

What I thought of was a simple hash table using BST for the collisions. Does that make sense or is there a simpler solution to this problem?

## elasticsearch – Amazon neptune full text search query not working as expected

I am trying to implement a full-text search for Neptune DB using elasticsearch manually but getting this error :

``````{"requestId":"bcb16f6b-7e60-4e71-b0d8-a6a4a9b38b00","code":"MalformedQueryException","detailedMessage":"Failed to interpret Gremlin query: null"}
``````

Here is my document:

``````{
"entity_id": "f8b9726f-74f9-a0e0-5fbd-b609bbb14f89",
"entity_type": (
"suggestions"
),
"document_type": "vertex",
"predicates": {
"title": {
"value": "samsung mobile"
}
}
}
``````

query:

``````g.withSideEffect('Neptune#fts.endpoint','nwptune end point').withSideEffect('Neptune#fts.queryType', 'match').V().has('title','Neptune#fts samsung').local(values('title').fold()).limit(5).valueMap().toList()
``````

it is giving error only if I am putting an existing word in search i.e Samsung but if I am searching for an unavailable word it worked fine not throwing any error.
Not sure what is wrong here, can anyone help me with this?

## algorithms – When is the expected time of a move to front list equal to that of an optimal list

When is the expected time of a move-to-front list equal to that of an optimal list?

My thinking is that it is when the move-to-front list happens to be arranged as an optimal list, but since the expected time takes the average over multiple times, this doesn’t really make sense. My only other thinking was the trivial case when the list has only one element.

## Applescript Expected “”” but found unknown token

This is my code. I wanted to run an app (Game Capture HD) twice at the same time. But I get this Syntax Error: Expected “”” but found unknown token.
Appreciate if anyone can fix it

``````on run
do shell script "open -n /Applications/Game Capture HD.app"
tell application "Game Capture HD" to activate
end run

on open theFiles
repeat with theFile in theFiles
do shell script "open -na /Applications/Game Capture HD.app " & quote & (POSIX path of theFile) & quote
end repeat
tell application "Game Capture HD" to activate
end open
``````

## Plotting a graph of a square root function does not show the expected graph

Use `RealAbs` instead of `Abs` since `Abs` is a `Complex` function.
And the `Sqrt` is also a `Complex` function, sometimes we use `Surd` instead of `Sqrt` or `Power`

if we assume `x` is a real numbers,we can use `ComplexExpand` to observe the expression of `Abs(Sqrt(x - 1) + 5)`

``````Abs(Sqrt(x - 1) + 5) // ComplexExpand

(*  Sqrt((5 + ((-1 + x)^2)^(1/4) Cos(1/2 Arg(-1 + x)))^2 +
Sqrt((-1 + x)^2) Sin(1/2 Arg(-1 + x))^2) *)
``````

So we had to use another way.

``````Plot(RealAbs(Surd(x-1,2)+5),{x,-5,5},AxesOrigin -> {0, 0})
``````

## postgresql – Data not reflecting after pg_upgrade in expected database

My Postgres v10.11 has data_directory at `'/post10/data'` location and has a tablespace at location `/xyz` for my ‘db1’ database.
I have tried upgrade of Postgresql database (version 10.11) to Postgresql (version 12.4).

And for Postgres v12.4 I am using default tablespace (`pg_default`).

After successful upgradation using `pg_upgrade` utility, ‘db1’ database is available but there is no relation in ‘db1’ , rather all the tables of ‘db1’ are in ‘`postgres`‘ database. Look here the size of `postgres` database:-

``````                                                                    List of databases
Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   |  Size   | Tablespace |                Description
-----------+----------+----------+-------------+-------------+-----------------------+---------+------------+--------------------------------------------
db1       | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |                       | 8345 kB | fastspace  |
postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |                       | 43 MB   | pg_default | default administrative connection database
template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +| 8217 kB | pg_default | unmodifiable empty database
|          |          |             |             | postgres=CTc/postgres |         |            |
template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | postgres=CTc/postgres+| 8345 kB | pg_default | default template for new databases
|          |          |             |             | =c/postgres           |         |            |
(4 rows)
``````

Though this is not production server but after successful testing here I have to do the same on production server. I want all data to be reflected under ‘db1’ in `pg_default` tablespace. I am stuck now how to do this.

## android development – Error class, interface, or enum expected in java

I kept getting this “error: class, interface, or enum expected”. People said it’s because misplacement of { or wrong pairs. But i counted it and it’s all right pairs. Here is my code. Thanks for your help.

Error part is last @override one. Public boolean ~ String url).

(It looks like your post is mostly code; please add some more details.)
(It looks like your post is mostly code; please add some more details.)
(It looks like your post is mostly code; please add some more details.)
(It looks like your post is mostly code; please add some more details.)

``````package com.stockbutler;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import java.net.URISyntaxException;

public class MainActivity extends AppCompatActivity {

private WebView webView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

webView= (WebView) findViewById(R.id.webview);
webView.setWebViewClient(new WebViewClient());
webView.getSettings() .setJavaScriptEnabled(true);
}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getAction()== KeyEvent.ACTION_DOWN){
switch (keyCode){
case KeyEvent.KEYCODE_BACK:
if (webView.canGoBack()){
webView.goBack();
}
else{
finish();
}
return true;
}
}
return super.onKeyDown(keyCode, event);
}
}

@Override
{if (url != null && url.startsWith("intent:")) {
try {
Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
Intent existPackage = getPackageManager().getLaunchIntentForPackage(intent.getPackage());
if (existPackage != null) {
startActivity(intent);
} else {
Intent marketIntent = new Intent(intent.ACTION_VIEW);
marketIntent.setData(Uri.parse("market://details?id=" + intent.getPackage()));
startActivity(marketIntent);
}
return true;
} catch (Exception e) {
e.printStackTrace();
}
} else if (url != null && url.startsWith("market:")) {
try {
Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
if (intent != null) {
startActivity(intent);
}
return true;
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
In Asymptotic Enumeration of Partial Orders on a Finite Set (1975), Kleitman and Rothschild showed that almost all partial orders on an $$n$$-element set have a simple description: they have three “layers” $$L_1$$, $$L_2$$, and $$L_3$$ of incomparable elements, of size $$n/4$$, $$n/2$$, and $$n/4$$ respectively. Each element of $$L_1$$ is covered by about half the elements of $$L_2$$. Likewise for $$L_2$$ and $$L_3$$, and in the reverse direction.
So almost all finite posets have height $$3$$.