mysql – What's wrong with this request? I get syntax errors when executing this query

Consider a table clerk who stores the details of the clerk.

ssn: employee social security number
address: registration of employee address

Looking at the address field in the employee table, you will notice that all employees reside in "Fondren, Houston, TX". Consider the whole in the address field as the house number. Consider the distance between the two houses as the difference in the house numbers, so the distance between houses number 2 and 38 is 36 units. Write a query to determine the average distance from the employee's house to ssn & # 39; 123456789 & # 39; and the homes of other employees. Print the answer to two decimal places. Make sure the response is formatted with a comma like x, xxx.xx.


Error: ERROR 1064 (42000) on line 5: you have an error in your SQL syntax; consult the manual that corresponds to your MySQL server version for the correct syntax to use near & # 39; & # 39; line 1


alter table employee add houseno int after address;

update employee set houseno = cast(substring(address, 1, instr(address, ' ') - 1);

create function average_distance (n char(9))
returns int deterministic
begin
 declare avg_dist INT
    select avg(abs(houseno - (select houseno from employee where ssn = n))) into avg_dist
    from employee where ssn <> n
 return (Avg)
end

select dist_btw_houses('123456789')

utf8 errors when recovering Cassandra strings

I was responsible for solving a problem occasionally encountered in a Cassandra database when recovering strings, by program or in CQLSH, and currently working with Cassandra version 2.1.15

The diagram of the appropriate table is as follows:

    CREATE TABLE proj_uat.response (
    key blob,
    column1 text,
    survey bigint,
    "surveyRun" bigint,
    value text,
    PRIMARY KEY (key, column1)
) WITH CLUSTERING ORDER BY (column1 ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';
CREATE INDEX response_survey_idx ON proj_uat.response (survey);
CREATE INDEX response_surveyRun_idx ON proj_uat.response ("surveyRun");

and we see two errors:

  1. The CQLSH instruction "SELECT value FROM proj_uat.response;" returns the error for a few lines:

The codec & # 39; utf8 & # 39; cannot decode byte 0x83 in position 7: invalid start byte

  1. The CQLSH instruction "SELECT survey FROM proj_uat.response;" returns the error for the occasional line:

error: decompressing requires a string argument of length 8

The database was initially configured in a Cassandra version which used Thrift (via the Pycassa python library) but it is no longer installed or may not even be available, and the CQLSH instructions above are executed in a Cassandra version which uses the new DataStax driver.

I wonder if all of this could be related to compact storage (https://blog.appoptics.com/cassandra-compact-storage/) because the original database where the current copy was was used used "compact_value" for the "value" column, whereas this column now appears as "regular".

Anyway, to shorten a long story, my main priority is to be able to export as much of this table as possible, preferably the whole, so that it can be re-imported into a Cassandra database put updated in 3.11.

However, I assume that all "standard" data export methods such as "COPY FROM" and "sstabledump" would fail on the same records. So I am wondering if there are any low level utilities or code examples that can directly access an sstable and dump its binary structure in one way or another.

Thanks in advance!

sharepoint online – Filter Get files (properties only) returning errors

I have two document libraries, one for working documents (word, excel, etc …) and one for published documents (pdf). I created a feed to convert the document to pdf. Generally it works. However, in order to update an existing pdf (i.e. archived), it must be extracted before creating the new file (no different from the manual attempt). So when I run the workflow with a document selected in the working library, I need it to check out the corresponding document (of the same name) in the published library.

Here is the general flow:

flow

I have tried two approaches to filter the Get files step using Filter Query.

Request 1: Name eq SOG_5000_001.docx
Production: {
"status": 400,
"message": "The" Name "column does not exist. It may have been deleted by another user.}

Request 2: FileLeafRef eq SOG_5000_001.docx
Production: {
"status": 400,
"message": "The column & # 39; SOG_5000_001.docx & # 39; does not exist. It may have been deleted by another user.}

I have confirmed that the two documents have the same name (FileLeafRef) in their respective libraries. However, I cannot understand why it makes errors rather than filtering for the only desired value.

t sql – SQL Server 2014 checkpoint, page errors and high disk I / O

Problem: the database has high disk usage and is in a deadlock, possibly due to a resource conflict.

The road to here:

  1. Captured a few counters to see where the problem is, looking at an outrageously high page reading (56 billion), page writing (330 million) per second with PLE = 19 s, I thought the server was running out of memory, d & Where the high number of errors which in turn leads to a high IO disk, but now this is more like a side effect of another operation.

  2. 56 billion I / O translates to 453 TB with a page size = 8 KB, which is much higher than the actual database size = 3.2 TB, I don't know how that is possible. Can we count on these metrics?


After this point, the server was restarted / reset and the last memory usage was 76% with the following buffer manager counters captured using the last request from this blog

Higher performance counters - Memory

High checkpoint pages / sec can cause high page faults (checkpoints and transaction logs)


My question is:

  1. Since all of the counters tell us about memory usage, I guess they are interdependent or at least relative to some extent. I could not find the recommended values ​​for these counters in msdn. So, how to interpret the figures without reference?
  2. If the checkpoint is the problem, how do you know for sure?
  3. If not, can you provide some input to dig into the root cause?

8 – Translations of URL D8 transposing between primary and secondary languages ​​or simply displaying errors

We have a multilingual Drupal 8 site (17 countries localized with 2 or more languages ​​each).

In the example I am attaching, we have a "people" page where we list the people for our business in this country. The URL path should display "insalar" instead of "people" for the Turkish Turkish translation. The path form field is displayed correctly. But the "View" tab, as well as the list in the administrators list, displays "people". (photo below)

The links to the page in English display "insalar". So he reverses it for an insane reason. But it doesn't happen for all types of content and it doesn't even happen all the time. It also doesn't seem to happen for every translation (and we have A LOT).

Any idea what could happen? We are 8.7.10.

enter description of image here

magento2 – The CSV uploader generates random errors for identical entries

I am trying to download 12000 sku (1000 at a time) using the csv downloader.

I get random errors for identical data.

For example: each cell of the attribute_set_column has a 9, but I get this error

 Invalid value for Attribute Set column (set doesn't exist?) in row(s): 575, 577

Is there a way to fix inconsistencies like this, or at least get less vague error messages?

Thank you

Container application errors VS 2019 for Kubernetes received during deployment with Azure DevOps Pipeline

I have created a container application for Kubernetes in Visual Studio as follows:

enter description of image here

The Docker file looks like this:

enter description of image here

Result of a successful race at Powershell:

enter description of image here

I tried to use the pipeline model – Deploy to Azure Kubernetes Service:

enter description of image here

I used the YAML "as is":

enter description of image here

When I save and run, I get the following:

enter description of image here

[error] Failed to copy: stat /var/lib/docker/tmp/docker-builder947419078/KubeApp/KubeApp.csproj: no file or directory of this type

[error] The process & # 39; / usr / bin / docker & # 39; failed with exit code 1

please give your opinion

innodb – Attempting to restore the database from ibd files but receiving errors when importing logical disk space

Recently, a client (who did not back up his system for any reason) had a database disaster, so his production database deleted all of his files EXCEPT his ibd files. I have recovered databases using logical disk space files by deleting and importing them before, but I was unlucky and I didn’t ; have encountered errors only when I try.

All tables except a few are InnoDB and the database engine is MariaDB 10.0.13.

When I do an import for any table, I get this in return: ERROR 1034 (HY000): Incorrect key file for table

; try to repair it. Being an InnoDB table, the repair does not work.

Extensive research has shown that this is most likely a disk space error. I had a lot of space but I stopped Maria, cleaned up the temporary directory and restarted it, and then I ran into the same problem.

I pulled the entire data folder internally to work with. I replaced the missing files for the database in question and Maria started without any problems but I still cannot handle the data. Even a selection will not work without crashing.

I tried a different approach by comparing the table locations of the same table on a new database in a hex editor and then updating the old ibd file to use the new ID ; logical disk space. Maria was able to start but I get InnoDB: No B+Tree found in tablespace in the logs when the service starts.

I registered innodb_sys_tables, innodb_sys_tablespace and innodb_sys_indexes in information_schema and nothing for this database is referenced. I am reasonably certain that this is a bad thing.

Are there options to attempt data recovery or has production data been lost?

object oriented – Error handling the approach to parameter errors in Typescript modules?

I was tormented by the question of how to handle parameter errors by consumers of my modules, and also in the classes that are extended from the base classes. The particular type of concern that I have concerns card keys in various utility classes. What to do if the consumer provides a key that does not exist in the collection or tries to add a new member with a key that already exists.

For example, suppose I have a collection class called & # 39; SortedMap & # 39; which allows a user to enter an item in a particular position in the collection, then allows the user to retrieve the item by its position in the collection or by its key, and also allows the user to change the position of an item in the collection by changing its sort property:

interface MapPosition {
    sort: number;
    index: number;
}

export interface MapItem {
    id: string;
    index: number;
    sort: number;
}

export class SortedMap {
    private _list: Array;
    private _map: Map;
    private _sorting: boolean; //status variable to prevent recursive 
                               //calls in sortChangehandler.
    private _positionMap: Map;

    constructor() {
        this._sorting = false;
        this._list = Array();
        this._map = new Map();
        this._positionMap = new Map();
    }

    get positionMap() {
        return this._positionMap;
    }

    private addSortChangeHandler(item: T): T {
        let self = this;
        if (this._positionMap.has(item.id)) {
            throw "This item is already in the collection!"
        }
        let myPosition = {};
        myPosition.index = 0;
        myPosition.sort = 0;
        self._positionMap.set(item.id, myPosition);
        let watcher = >{}

        watcher.set = function (target, p, value, receiver) {
            let myPosition: MapPosition;
            let resortRequired = false;
            myPosition = self._positionMap.get(receiver.id)!;
            switch (p) {
                case "sort":
                    if (value < 0) { value = -1 }
                    myPosition.sort = value;
                    if (!self._sorting) {
                        resortRequired = true;
                    }
                    break;
                case "index":
                    myPosition.index = value;
                    break;
                case "id":
                    target.id = value;
                    break;
            }
            if (resortRequired) {
                resortRequired = false;
                console.log("resort triggered by sort change");
                self.sortIndex();
            }
            return true;
        }

        watcher.get = function (target: T, prop: string, receiver) {
            let myId = item("id");
            let myPosition = self._positionMap.get(myId)!;
            switch (prop) {
                case 'index':
                    return myPosition.index;
                case 'sort':
                    return myPosition.sort;
                case 'id':
                    return myId;
                default:
                    return Reflect.get(target, prop, receiver);
            }
        }
        let proxy = new Proxy(item, watcher);
        return proxy;
    }

    getItem(id: string): T {
        if (!this._map.has(id)) {
            throw `The id ${id} was not found in this Map`;
        } else {
            let value = this._map.get(id);
            return this._map.get(id)!;
        }
    };

    getAt(index: number): T {
        if (!(this.existsIndex(index))) {
            throw `error (SortedMap.getAt()) An invalid index (${index}) was supplied to getAt.  The map has ${this.count} items.`;
        }
        return this._list(index);
    }

    get list(): Array {
        return this._list;
    }

    first(): T | null {
        if (this.count > 0) {
            return this.getAt(0);
        }
        return null;
    }

    last(): T | null {
        let mycount = this.count;
        if (mycount === 0) {
            return null;
        }
        return this._list(mycount - 1);
    }

    add(item: T, key?: string): T {
        if (key === undefined || key === "")
            if (!item.id) {
                throw "Can't add item with neither key or undefined id.";
            } else {
                {
                    key = item.id
                };
            }
        if (this.exists(key)) {
            throw "attempt to add duplicate key " + key;
        }
        let proxyItem = this.addSortChangeHandler(item);
        this._list.push(proxyItem);
        this._map.set(key, proxyItem);

        this.makeIndex();
        return proxyItem
    }

    remove(key: string): T | null {

        if (this._map.has(key)) {
            let item = this._map.get(key)!;
            this._map.delete(key);
            this._list = Array.from(this._map.values());
            this.sortIndex();
            return item;
        }
        return null;
    }

    exists(key: string): boolean {
        if (!key) {
            throw "Can't call exists on falsey key.";
        }
        return this._map.has(key);
    }

    existsIndex(index: number): boolean {
        if ((index < 0) || (index > (this._list.length - 1))) { return false }
        return true;
    }

    moveUp(id: string): void {
        let f = this.getItem(id);
        if (f.index === 0) {
            return;
        }
        f.sort = ((f.index - 1) * 10) - 1
    }

    moveDown(id: string): void {
        let f = this.getItem(id);
        if (f.index >= this.count - 1) { return; }
        f.sort = ((f.index + 1) * 10) + 1;
    }




    insertBeforeIndex(index: number, item: T): T {
        if (this.exists(item.id)) { throw `duplicate key - ${item.id}` }
        if (!this.existsIndex(index)) throw `index out of range - ${index}`;

        this._sorting = true;
        let olditem = this._list(index);

        item.sort = olditem.sort - 1;
        this._list.push(item);
        this._map.set(item.id, item);
        this._sorting = false;
        this.sortIndex();

        return item;
    }


    insertBeforeKey(beforeKey: string, item: T) {
        if (this.exists(item.id)) { throw `duplicate key - ${item.id}` }
        if (this.exists(beforeKey)) {

            let insertAt = this.getItem(beforeKey)!.sort - 1;
            this._sorting = true;
            item.sort = insertAt;
            this._list.push(item);
            this._sorting = false;
            this.sortIndex();
            return item;
        } else {
            throw `beforeKey ${beforeKey} not found`;
        }
    }

    /**sets the sort index property and the index property based on teh current
     * position of each item in the list.
     */
    private makeIndex(): void {
        let counter: number = 0;
        this._sorting = true;
        this._list.forEach(function (item) {
            item.index = counter;

            item.sort = (counter * 10);

            counter += 1;
        });
        this._sorting = false;

    }
    /**sorts the list by the current sort index, sets the index and 
     * sort property of each item based on its new position in the list.
     * 
    **/
    sortIndex(): void {
        this._sorting = true
        this._list.sort(function (a, b) {
            return a.sort > b.sort ? 1 : -1;
        });
        this.makeIndex();
        this._sorting = false;

    }

    get count(): number {
        return this._list.length;
    }

}

At one point, I decided that I should elegantly handle all errors when an "incorrect" parameter was supplied, for example by returning "undefined" or "null" where a getItem(key: string) was provided with a nonexistent key. However, I discovered the approach of handling things elegantly so that the exceptions were not thrown, bugs hidden, so it was much more difficult to understand why I was had an internal class error. So I have started throwing exceptions for errors like these, but I have a lingering concern that this approach makes it more likely that the end user experience will be more seriously altered when errors occur due to unforeseen edge cases, where the running program stops and returns. an error message that only makes sense to a developer.

So, for example, suppose someone consumes a SortedMap as follows:

import {SortedMap} from "../lib/util";
import {MapItem} from "../lib/util";

class Account implements MapItem {
    id: string;    
    index: number = 0;
    sort: number = 0;
    name: string
    balance: number;

    constructor(id : string, name: string, balance: number)   {
        this.id = id;
        this.name = name;
        this.balance = balance;
    }
 }

class Accounts extends SortedMap {
    getAccountById(id: string) : Account {
        return this.getItem(id);
    }
    getTotal() {
        let total=0;
        for (let ac of this.list) {
            total += ac.balance;
        }
    }
}

What would be the best way to deal with a problem where the consumer of Accounts called getAccountById with an identifier that has not been added to the collection?

Assuming that this class is consumed, say, by an angular application, would it make more sense to

a) do nothing and let the method call return the error returned by SortedMap, ("The identifier {…} could not be found in this card.")
b) check the existence of the key in Accounts.getAccountById using SortedMap.exists (id) and raise an error such as "This account does not exist")
c) returns undefined or null or an object which represents a nonexistent account

Or something else. I guess the question is about the balance between ease of debugging, the time it takes to write parameter error traps throughout the call chain and the effect on End user encountering undiscovered errors that appear in the production code.

I never know exactly how to balance these various competing priorities with a consistent approach to error handling.

Welcome advice.