问:
How to make a Movement/Maze Collission function
I am trying to code a simple maze where you can simply move around the map.

I already have a movement function but need a function that's something like an if touching colour #fff000 then bounce back.
I haven't been able to think of a way to do it and would like some help.

Down below you will find my code that I used. The maze is pretty simple, you control a nuclear symbol around but it starts on the maze wall.

I would some help on the css to move it off the wall when it starts.

var objImage;

function init() {
  objImage = document.getElementById("image1");
  objImage.style.position = "relative";
  objImage.style.left = "0px";
  objImage.style.top = "0px";
}

function getKeyAndMove(e) {
  var key_code = e.which || e.keyCode;
  switch (key_code) {
    case 37:
      moveLeft();
      break;
    case 38:
      moveUp();
      break;
    case 39:
      moveRight();
      break;
    case 40:
      moveDown();
      break;
  }
}

function moveLeft() {
  objImage.style.left = parseInt(objImage.style.left) - 17 + "px";
}

function moveUp() {
  objImage.style.top = parseInt(objImage.style.top) - 17 + "px";
}

function moveRight() {
  objImage.style.left = parseInt(objImage.style.left) + 17 + "px";
}

function moveDown() {
  objImage.style.top = parseInt(objImage.style.top) + 17 + "px";
}
window.onload = init;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
  background-image: url('https://cdn.glitch.global/db8bf4ca-15e3-46f7-82cc-f9266324510d/Maze%20code%20thingy.png?v=1671163203972');
  background-repeat: no-repeat;
}</code>```

```

Body:
I am trying to code a simple maze where you can simply move around the map.

I already have a movement function but need a function that's something like an if touching colour #fff000 then bounce back.
I haven't been able to think of a way to do it and would like some help.

Down below you will find my code that I used. The maze is pretty simple, you control a nuclear symbol around but it starts on the maze wall.

I would some help on the css to move it off the wall when it starts.

var objImage;

function init() {
  objImage = document.getElementById("image1");
  objImage.style.position = "relative";
  objImage.style.left = "0px";
  objImage.style.top = "0px";
}

function getKeyAndMove(e) {
  var key_code = e.which || e.keyCode;
  switch (key_code) {
    case 37:
      moveLeft();
      break;
    case 38:
      moveUp();
      break;
    case 39:
      moveRight();
      break;
    case 40:
      moveDown();
      break;
  }
}

function moveLeft() {
  objImage.style.left = parseInt(objImage.style.left) - 17 + "px";
}

function moveUp() {
  objImage.style.top = parseInt(objImage.style.top) - 17 + "px";
}

function moveRight() {
  objImage.style.left = parseInt(objImage.style.left) + 17 + "px";
}

function moveDown() {
  objImage.style.top = parseInt(objImage.style.top) + 17 + "px";
}
window.onload = init;

body {
  background-image: url('https://cdn.glitch.global/db8bf4ca-15e3-46f7-82cc-f9266324510d/Maze%20code%20thingy.png?v=1671163203972');
  background-repeat: no-repeat;
}


来源: stackexchange

问:
DSpace 6 - Custom Metadata Field
In DSpace 6.3, when I try to export metadata in a particular collection where .csv file will be downloaded in that file how could I add a custom field or column of fulltextpdf column or Name of the file column where can I modify to get this column.
I have attached the .csv file, So please guide me to solution to add a custom column in the metadata.
When I export the metadata so that I could get all the fields including added column.

Thanks & Regards
Sai Kumar S

I have attached the .csv file, So please guide me to solution to add a custom column in the metadata.
When I export the metadata so that I could get all the fields including added column.

[enter image description here][1]
[1]: https://i.stack.imgur.com/KLlne.png

ContentLicense: CC BY-SA 4.0

Title: DSpace 6 - Custom Metadata Field


问:
SQL records to JSON Single Object
I need to convert a 2 columns result to JSON using first as field and second as value.

Given the fallowing records

FomrField
Value

Name
Jhon

Age
51

Job
Artist

I would need the next JSON Result:

{
"Name": "Jhon",
"Age": "51",
"Job": "Artist"
}

I have tried "for json path":

select FormField, Value from FormsData for json path -- for json path, WITHOUT_ARRAY_WRAPPER

But what I'm looking for is one single json object, and what I get with the previous approach is either an array or a bunch of objects, always having two sets of key-values based on the columns name.

Title: SQL records to JSON Single Object


问:
Selenium - How can I force all javascript to execute after the page load event?
I am writing a crawler in python with selenium. To measure the performance of certain javascript functions. Ignoring AJAX, I think pausing the javascript execution when the browser is downloading resources (like pictures and stylesheets) would give me a more precise result.

How can I force all javascript to execute after the page load event?


问:
How to calculate time and monitor the memory for an api call in cherry py python
I developed the cherry py application i given task to calculate the time taken for each api calls and monitor its memory, i thought of using the dispatcher but dont know the implementation

to implement api call monitoring and code for that


问:
How to deal with large numbers from specific range?
I have struggled with errors while modifying the below code to select numbers from specific range.

```<code>// RANDOM NUMBERS:
struct seed
{
    uint256_t seed;
    uint128_t counter;
};

/*
 * Create a new random seed.
 */
static struct seed *make_seed(void)
{
    struct seed *seed = (struct seed *)malloc(sizeof(struct seed));
    assert(seed != NULL);
    seed->counter = 0;
    if (!init_rand(seed, sizeof(struct seed)))
    {
        fprintf(stderr, "error: failed to init random seed\n");
        exit(EXIT_FAILURE);
    }
    if (seed->counter == 0)     // Sanity check...
    {
        fprintf(stderr, "error: random seed initialization failed\n");
        exit(EXIT_FAILURE);
    }
    return seed;
}

/*
 * Get a new random number.
 */
static uint256_t rand256(struct seed *seed)
{
    seed->counter++;
    return sha256(seed, sizeof(struct seed));
}

</code>```

It's the code from pairgen.

How do I get the above function to select numbers from specific range?

I do not understand what seed is doing and how this outputs a number because sha256 requires data and size

Body:
I have struggled with errors while modifying the below code to select numbers from specific range.

// RANDOM NUMBERS:
struct seed
{
    uint256_t seed;
    uint128_t counter;
};

/*
 * Create a new random seed.
 */
static struct seed *make_seed(void)
{
    struct seed *seed = (struct seed *)malloc(sizeof(struct seed));
    assert(seed != NULL);
    seed->counter = 0;
    if (!init_rand(seed, sizeof(struct seed)))
    {
        fprintf(stderr, "error: failed to init random seed\n");
        exit(EXIT_FAILURE);
    }
    if (seed->counter == 0)     // Sanity check...
    {
        fprintf(stderr, "error: random seed initialization failed\n");
        exit(EXIT_FAILURE);
    }
    return seed;
}

/*
 * Get a new random number.
 */
static uint256_t rand256(struct seed *seed)
{
    seed->counter++;
    return sha256(seed, sizeof(struct seed));
}

It's the code from pairgen.

How do I get the above function to select numbers from specific range?

I do not understand what seed is doing and how this outputs a number because sha256 requires data and size


问:
groovy.xml.StreamingMarkupBuilder not working in jenkins
I am trying to create a new Xml file and add already parsed data from other file to it using groovy

But jenkins is throwing a error stating "No such property settings for class StreamingMarkupbuilder "

settingsObj is already parsed data which I am trying to add to this file

```<code>def xmlFile=new StreamingMarkupBuilder().bind{
    settings{
        mkp.yeild settingsObj.servers.children()
    }
}

</code>```

Body:
I am trying to create a new Xml file and add already parsed data from other file to it using groovy

But jenkins is throwing a error stating "No such property settings for class StreamingMarkupbuilder "

settingsObj is already parsed data which I am trying to add to this file

def xmlFile=new StreamingMarkupBuilder().bind{
    settings{
        mkp.yeild settingsObj.servers.children()
    }
}


问:
How to find an application cache on an android device from linux
I accidentally deleted my private key from my email (protonmail) on PC and didn't have it saved anywhere, and can't decrypt any of my old emails. I tried contacting the support but it was no help. I noticed that I can still read older emails fine on my phone and it even encrypts newly sent emails with the old key. I tried asking the support how to extract the key but they said it can't be done. So I'm trying to find it myself and add it to my account again. I think it's cached and the application haven't queried for the new key yet.
The problem is I don't know anything about android or where the files are stored.
I tried connecting my device (Moto G 5G) to my linux and searching through the files with no luck, the application folder is empty, but the phone shows there is data in the cache (around 57kb).

I searched around and found this. But I never used adb and I'm unable to find the device from adb and I couldn't find drivers in case it was a driver issue.

My question is why I can't find any application cache? Is it a permission issue? And is there a way to extract it from my phone? If it's a complicated issue then can you please point me to the right place to read more on connecting to android or how to get started as I can't find proper docs to do so. Thanks


问:
An error occurred in the Microsoft . NET Framework while trying to load assembly
After transferring the Database to another server, I am receiving below error while running a function which uses an assembly in MSSSQL:
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65547. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error: System.IO.FileLoadException: Could not load file or assembly 'clrprocedure, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A)

After a long R&D, i got the solution. The TRUSTWORTHY property of the database was turned OFF previously.
ALTER DATABASE [dbase] SET trustworthy ON

But I have a new problem, my database is in read-only mode, and I can't apply this script. Tell me what to do?

The TRUSTWORTHY property of the database was turned OFF previously.
ALTER DATABASE [dbase] SET trustworthy ON


问:
Automated commits with Jenkins
Following scenario: a cicd pipeline at an openshift account where I have very limited accesses (just logging outputs, secrets and redeploy). I used to build my images in Jenkins, where I had the "build periodically" option. I work with an upper abstraction layer , built upon redhat openshift, that contains its own pipeline to build images but not an "scheduled / automated build function", hence I have to redeploy my 40+ microservices periodically so that I can keep the pods clear of vulnerabilities. A huge piece of manual work...

I don't plan to move my image building back to Jenkins, but I was wondering if is it possible to , for instance, using Jenkins to check in my git repositories and generate some automated commit of sorts (like a readme file update), which in turn would trigger a build automatically at my openshift cluster.

Might sound like a crazy idea but , has anyone ever came across a similar scenario? Could it be doable? I have both Jenkins and TravisCI avaliable for my project.

I tried thinking how a cronjob of sorts would help me getting this done, but since to my limited OC access scope, I don't think I would be able to even create a cron.

Title: Automated commits with Jenkins


问:
Ag Grid Set Filter Issue not able to be formatting value with different key
one technical question for whom having hands on ag-grid angular, we came in scenario where we have set filter and to display value to user is something descriptive e.g., like a country name, and while applying a filter have to send some code e.g., country code to backend application. we tried couple of ways but didn't get luck in that. any expert help?

expectation is there any way to handle display with different key and sending data with different key to backend application on applying filter


问:
How to configure kaldi with cuda to run the codes on GPU?
I have installed both latest kaldi and cuda v11.0. But i dont how to configure kaldi with cuda.

Please help me with installation


问:
trying to fix this but cant find a solution
Hey I am new to coding and I wanted to fix this can somebody help me here is my code and error by the way this is a discord bot that I am trying to make it work but seems to be running into this issue constantly is there any other way I can replace the masters and run it some other way

```<code>#cython: language_level=3

import data
import config
import discord
import userCommands
import adminCommands

from discordHelper import newEmbed, errorMessage, RED, BLUE, GREEN, YELLOW

PREFIX = '+'

class DiscordBot(discord.Client):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        allData = data.loadJSON(data.DATABASE_FILENAME)
        self.masterIDs = allData['Masters']
        self.staffIDs = allData['Staff']

    async def on_ready(self):
        '''
            Called when the discord bot logs in
        '''
        print(f'{self.user.name} Logged In!')
        print('--------------------\n')

    async def on_reaction_add(self, reaction: discord.Reaction, user: discord.User):
        # Unsubscribe from vouch notifications
        description = reaction.message.embeds[0].description
        if 'Received a' in description and reaction.emoji == '❌':
            noNotifs = data.loadJSON(data.DATABASE_FILENAME)[
                'NoNotificationIDs']
            if user.id not in noNotifs:
                embed = newEmbed(
                    description='Unsubscribed from notifications!')
                embed.set_footer(
                    text='To resubscribe, react with ✅')
                noNotifs.append(user.id)
                data.updateJson(data.DATABASE_FILENAME, {
                                'NoNotificationIDs': noNotifs})
                await user.send(embed=embed)

        # Resubscribe to vouch notifications
        elif 'Unsubscribed' in description and reaction.emoji == '✅':
            noNotifs = data.loadJSON(data.DATABASE_FILENAME)[
                'NoNotificationIDs']
            if user.id in noNotifs:
                embed = newEmbed(description='Resubscribed to notifications!')
                embed.set_footer(text='To unsubscribe, react with ❌')
                noNotifs.remove(user.id)
                data.updateJson(data.DATABASE_FILENAME, {
                                'NoNotificationIDs': noNotifs})
                await user.send(embed=embed)

    async def on_message(self, message: discord.Message):
        '''
            Handles all the discord commands
        '''
        # Make sure we don't respond to ourselves
        if message.author == self.user:
            return

        isMaster = message.author.id in self.masterIDs
        isStaff = message.author.id in self.staffIDs or isMaster
        loweredMsg = message.content.lower()
        words = message.content.split()

        # =====================================================

        if loweredMsg.startswith('+vouch') or loweredMsg.startswith('-vouch'):
            if len(message.mentions) == 0 or len(words) < 3:
                await errorMessage('Please follow this format: [+ or -]vouch [@user] [message]',
                                   message.channel)
                return

            if message.author.id == message.mentions[0].id:
                await errorMessage('You cannot vouch for yourself.', message.channel)
                return

            vouchMessage = ' '.join(words[2:])
            isPositive = loweredMsg[0] == '+'
            pendingChannel = self.get_channel(config.PENDING_VOUCHES_CHANNELID)
            await userCommands.vouch(message.author,
                                     message.mentions[0],
                                     vouchMessage,
                                     isPositive,
                                     message.channel,
                                     pendingChannel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}dwc') and isMaster:
            if 'dwc1' in loweredMsg:
                level = 1
            elif 'dwc2' in loweredMsg:
                level = 2
            elif 'dwc3' in loweredMsg:
                level = 3
            else:
                level = 0

            if len(message.mentions) == 0 or (level != 0 and len(words) < 3):
                await errorMessage(f'Please follow this format: {PREFIX}dwc [@user] [reason]',
                                   message.channel)
                return

            reason = ' '.join(words[2:]) if level != 0 else ''
            await adminCommands.dwc(message.mentions[0], level, reason, message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}scammer') and isMaster:
            if len(message.mentions) == 0:
                await errorMessage(f'Please follow this format: {PREFIX}scammer [@user]',
                                   message.channel)
                return

            await adminCommands.scammer(message.mentions[0], message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}pending') and isStaff:
            await adminCommands.pending(message.channel, self.get_user)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}leaderboard'):
            await userCommands.leaderboard(message.channel, self.get_user, self.user.avatar_url)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}reply') and isStaff:
            if len(words) < 3 or not words[1].isdigit():
                await errorMessage(f'Please follow this format: {PREFIX}reply [vouch id] [message]',
                                   message.channel)
                return

            targetUser = None
            try:
                vouchID = int(words[1])
                pending = data.loadJSON(data.DATABASE_FILENAME)['PendingVouches']
                for i in pending:
                    if i['ID'] == vouchID:
                        targetUser = self.get_user(i['Giver'])
                        break
                else:
                    raise Exception('User not found')

            except Exception as e:
                print(e)
                await errorMessage(f'Could not find user with ID {vouchID}',
                                   message.channel)
                return

            replyMsg = ' '.join(words[2:])
            await adminCommands.reply(targetUser, replyMsg, message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}remove') and isMaster:
            if len(message.mentions) == 0 or len(words) < 2:
                await errorMessage(f'Please follow this format:\n{PREFIX}remove [@user]\n**or**\n{PREFIX}remove [@user] [vouch ID]',
                                   message.channel)
                return

            vouchNum = -1
            if len(words) >= 3 and words[2].isdigit():
                vouchNum = int(words[2])
                if vouchNum < 0:
                    await errorMessage('Vouch ID cannot be negative!', message.channel)
                    return

            await adminCommands.remove(message.mentions[0], message.channel, vouchNum)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}verify') and isMaster:
            if len(message.mentions) == 0:
                await errorMessage(f'Please follow this format: {PREFIX}verify [@user]',
                                   message.channel)
                return

            await adminCommands.verify(message.mentions[0], message.channel)

        # =====================================================

        elif (loweredMsg.startswith('+add') or loweredMsg.startswith('-add')) and isMaster:
            if len(message.mentions) == 0 or len(words) < 3:
                await errorMessage(f'Please follow this format: [+ or -]add [@user] [giverID (optional)] [message]',
                                   message.channel)
                return

            # Check if they specify the giver ID
            hasGiverID = False
            giverID = 0
            if words[2].isdigit():
                hasGiverID = True
                giverID = int(words[2])

            vouchMessage = ' '.join(
                words[3:]) if hasGiverID else ' '.join(words[2:])
            isPositive = loweredMsg[0] == '+'
            logChannel = self.get_channel(config.LOG_CHANNEL_ID)
            await adminCommands.add(message.author,
                                    message.mentions[0],
                                    vouchMessage,
                                    isPositive,
                                    message.channel,
                                    logChannel,
                                    giverID)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}token'):
            await userCommands.token(message.author, message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}profile'):
            if len(message.mentions) == 0:
                user = message.author
            else:
                user = message.mentions[0]

            await userCommands.profile(
                targetUser=user,
                bcGuild=self.get_guild(583416004974084107),
                channel=message.channel
            )

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}link'):
            if len(words) < 2:
                await errorMessage(
                    f'Please follow this format: {PREFIX}link [https://nulled.to/ link]',
                    message.channel)
                return

            if 'https://nulled.to/' not in words[1]:
                await errorMessage(
                    'Please provide a proper nulled.to link!',
                    message.channel)
                return

            await userCommands.link(message.author, words[1], message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}redeem'):
            if len(words) <= 1:
                await errorMessage(f'Please follow this format: {PREFIX}redeem [token]',
                                   message.channel)
                return

            await userCommands.redeem(message.author, words[1],
                                      message.channel, self.logChannel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}admin') and isMaster:
            if len(message.mentions) == 0:
                await errorMessage(f'Please follow this format: {PREFIX}admin [@user]',
                                   message.channel)
                return

            await adminCommands.admin(message.mentions[0], message.channel)
            if message.mentions[0].id in self.masterIDs:
                self.masterIDs.remove(message.mentions[0].id)
            else:
                self.masterIDs.append(message.mentions[0].id)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}staff') and isMaster:
            if len(message.mentions) == 0:
                await errorMessage(f'Please follow this format: {PREFIX}staff [@user]',
                                   message.channel)
                return

            await adminCommands.staff(message.mentions[0], message.channel)
            if message.mentions[0].id in self.staffIDs:
                self.staffIDs.remove(message.mentions[0].id)
            else:
                self.staffIDs.append(message.mentions[0].id)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}blacklist') and isMaster:
            if len(message.mentions) == 0:
                if len(words) >= 2 and not words[1].isdigit():
                    await errorMessage(f'Please follow this format: {PREFIX}blacklist [@user]',
                                       message.channel)
                    return

            if len(message.mentions) != 0:
                id = message.mentions[0].id
            else:
                id = int(words[1])

            await adminCommands.blacklist(id, message.channel)

        # =====================================================

        elif (loweredMsg.startswith(f'{PREFIX}approve') or
              loweredMsg.startswith(f'{PREFIX}accept')) and isStaff:
            if len(words) < 2 or not words[1].isdigit():
                await errorMessage(f'Please follow this format: {PREFIX}approve [vouch ID]',
                                   message.channel)
                return

            ids = [int(i) for i in words[1:] if i.isdigit()]
            logChannel = self.get_channel(config.LOG_CHANNEL_ID)
            for i in ids:
                await adminCommands.approve(i, message.channel,
                                            logChannel, self.get_user)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}deny') and isStaff:
            if len(words) < 2 or not words[1].isdigit():
                await errorMessage(f'Please follow this format: {PREFIX}deny [vouch ID]',
                                   message.channel)
                return

            ids = [int(i) for i in words[1:] if i.isdigit()]
            for i in ids:
                await adminCommands.deny(i, message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}help'):
            await userCommands.help(PREFIX,
                                    message.channel,
                                    isMaster)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}about'):
            await userCommands.about(message.channel, self.user.avatar_url)

        # =====================================================

def main():
    DiscordBot().run(config.DISCORD_TOKEN)

if __name__ == '__main__':
    main()
</code>```

(config.py

```<code>DISCORD_TOKEN = 'OwOD'
PENDING_VOUCHES_CHANNELID = 105159912
LOG_CHANNEL_ID = 1051599
</code>```

here is the error

```<code>File "c:\Users\ne\Desktop\test bot\main.py", line 348, in main
    DiscordBot().run(config.DISCORD_TOKEN)
  File "c:\Users\ne\Desktop\test bot\main.py", line 19, in __init__
    self.masterIDs = allData['Masters']
KeyError: 'Masters'
</code>```

I was expecting to work after changing some values but no solution

Body:
Hey I am new to coding and I wanted to fix this can somebody help me here is my code and error by the way this is a discord bot that I am trying to make it work but seems to be running into this issue constantly is there any other way I can replace the masters and run it some other way

#cython: language_level=3

import data
import config
import discord
import userCommands
import adminCommands

from discordHelper import newEmbed, errorMessage, RED, BLUE, GREEN, YELLOW

PREFIX = '+'

class DiscordBot(discord.Client):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        allData = data.loadJSON(data.DATABASE_FILENAME)
        self.masterIDs = allData['Masters']
        self.staffIDs = allData['Staff']

    async def on_ready(self):
        '''
            Called when the discord bot logs in
        '''
        print(f'{self.user.name} Logged In!')
        print('--------------------\n')

    async def on_reaction_add(self, reaction: discord.Reaction, user: discord.User):
        # Unsubscribe from vouch notifications
        description = reaction.message.embeds[0].description
        if 'Received a' in description and reaction.emoji == '❌':
            noNotifs = data.loadJSON(data.DATABASE_FILENAME)[
                'NoNotificationIDs']
            if user.id not in noNotifs:
                embed = newEmbed(
                    description='Unsubscribed from notifications!')
                embed.set_footer(
                    text='To resubscribe, react with ✅')
                noNotifs.append(user.id)
                data.updateJson(data.DATABASE_FILENAME, {
                                'NoNotificationIDs': noNotifs})
                await user.send(embed=embed)

        # Resubscribe to vouch notifications
        elif 'Unsubscribed' in description and reaction.emoji == '✅':
            noNotifs = data.loadJSON(data.DATABASE_FILENAME)[
                'NoNotificationIDs']
            if user.id in noNotifs:
                embed = newEmbed(description='Resubscribed to notifications!')
                embed.set_footer(text='To unsubscribe, react with ❌')
                noNotifs.remove(user.id)
                data.updateJson(data.DATABASE_FILENAME, {
                                'NoNotificationIDs': noNotifs})
                await user.send(embed=embed)

    async def on_message(self, message: discord.Message):
        '''
            Handles all the discord commands
        '''
        # Make sure we don't respond to ourselves
        if message.author == self.user:
            return

        isMaster = message.author.id in self.masterIDs
        isStaff = message.author.id in self.staffIDs or isMaster
        loweredMsg = message.content.lower()
        words = message.content.split()

        # =====================================================

        if loweredMsg.startswith('+vouch') or loweredMsg.startswith('-vouch'):
            if len(message.mentions) == 0 or len(words) < 3:
                await errorMessage('Please follow this format: [+ or -]vouch [@user] [message]',
                                   message.channel)
                return

            if message.author.id == message.mentions[0].id:
                await errorMessage('You cannot vouch for yourself.', message.channel)
                return

            vouchMessage = ' '.join(words[2:])
            isPositive = loweredMsg[0] == '+'
            pendingChannel = self.get_channel(config.PENDING_VOUCHES_CHANNELID)
            await userCommands.vouch(message.author,
                                     message.mentions[0],
                                     vouchMessage,
                                     isPositive,
                                     message.channel,
                                     pendingChannel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}dwc') and isMaster:
            if 'dwc1' in loweredMsg:
                level = 1
            elif 'dwc2' in loweredMsg:
                level = 2
            elif 'dwc3' in loweredMsg:
                level = 3
            else:
                level = 0

            if len(message.mentions) == 0 or (level != 0 and len(words) < 3):
                await errorMessage(f'Please follow this format: {PREFIX}dwc [@user] [reason]',
                                   message.channel)
                return

            reason = ' '.join(words[2:]) if level != 0 else ''
            await adminCommands.dwc(message.mentions[0], level, reason, message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}scammer') and isMaster:
            if len(message.mentions) == 0:
                await errorMessage(f'Please follow this format: {PREFIX}scammer [@user]',
                                   message.channel)
                return

            await adminCommands.scammer(message.mentions[0], message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}pending') and isStaff:
            await adminCommands.pending(message.channel, self.get_user)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}leaderboard'):
            await userCommands.leaderboard(message.channel, self.get_user, self.user.avatar_url)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}reply') and isStaff:
            if len(words) < 3 or not words[1].isdigit():
                await errorMessage(f'Please follow this format: {PREFIX}reply [vouch id] [message]',
                                   message.channel)
                return

            targetUser = None
            try:
                vouchID = int(words[1])
                pending = data.loadJSON(data.DATABASE_FILENAME)['PendingVouches']
                for i in pending:
                    if i['ID'] == vouchID:
                        targetUser = self.get_user(i['Giver'])
                        break
                else:
                    raise Exception('User not found')

            except Exception as e:
                print(e)
                await errorMessage(f'Could not find user with ID {vouchID}',
                                   message.channel)
                return

            replyMsg = ' '.join(words[2:])
            await adminCommands.reply(targetUser, replyMsg, message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}remove') and isMaster:
            if len(message.mentions) == 0 or len(words) < 2:
                await errorMessage(f'Please follow this format:\n{PREFIX}remove [@user]\n**or**\n{PREFIX}remove [@user] [vouch ID]',
                                   message.channel)
                return

            vouchNum = -1
            if len(words) >= 3 and words[2].isdigit():
                vouchNum = int(words[2])
                if vouchNum < 0:
                    await errorMessage('Vouch ID cannot be negative!', message.channel)
                    return

            await adminCommands.remove(message.mentions[0], message.channel, vouchNum)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}verify') and isMaster:
            if len(message.mentions) == 0:
                await errorMessage(f'Please follow this format: {PREFIX}verify [@user]',
                                   message.channel)
                return

            await adminCommands.verify(message.mentions[0], message.channel)

        # =====================================================

        elif (loweredMsg.startswith('+add') or loweredMsg.startswith('-add')) and isMaster:
            if len(message.mentions) == 0 or len(words) < 3:
                await errorMessage(f'Please follow this format: [+ or -]add [@user] [giverID (optional)] [message]',
                                   message.channel)
                return

            # Check if they specify the giver ID
            hasGiverID = False
            giverID = 0
            if words[2].isdigit():
                hasGiverID = True
                giverID = int(words[2])

            vouchMessage = ' '.join(
                words[3:]) if hasGiverID else ' '.join(words[2:])
            isPositive = loweredMsg[0] == '+'
            logChannel = self.get_channel(config.LOG_CHANNEL_ID)
            await adminCommands.add(message.author,
                                    message.mentions[0],
                                    vouchMessage,
                                    isPositive,
                                    message.channel,
                                    logChannel,
                                    giverID)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}token'):
            await userCommands.token(message.author, message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}profile'):
            if len(message.mentions) == 0:
                user = message.author
            else:
                user = message.mentions[0]

            await userCommands.profile(
                targetUser=user,
                bcGuild=self.get_guild(583416004974084107),
                channel=message.channel
            )

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}link'):
            if len(words) < 2:
                await errorMessage(
                    f'Please follow this format: {PREFIX}link [https://nulled.to/ link]',
                    message.channel)
                return

            if 'https://nulled.to/' not in words[1]:
                await errorMessage(
                    'Please provide a proper nulled.to link!',
                    message.channel)
                return

            await userCommands.link(message.author, words[1], message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}redeem'):
            if len(words) <= 1:
                await errorMessage(f'Please follow this format: {PREFIX}redeem [token]',
                                   message.channel)
                return

            await userCommands.redeem(message.author, words[1],
                                      message.channel, self.logChannel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}admin') and isMaster:
            if len(message.mentions) == 0:
                await errorMessage(f'Please follow this format: {PREFIX}admin [@user]',
                                   message.channel)
                return

            await adminCommands.admin(message.mentions[0], message.channel)
            if message.mentions[0].id in self.masterIDs:
                self.masterIDs.remove(message.mentions[0].id)
            else:
                self.masterIDs.append(message.mentions[0].id)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}staff') and isMaster:
            if len(message.mentions) == 0:
                await errorMessage(f'Please follow this format: {PREFIX}staff [@user]',
                                   message.channel)
                return

            await adminCommands.staff(message.mentions[0], message.channel)
            if message.mentions[0].id in self.staffIDs:
                self.staffIDs.remove(message.mentions[0].id)
            else:
                self.staffIDs.append(message.mentions[0].id)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}blacklist') and isMaster:
            if len(message.mentions) == 0:
                if len(words) >= 2 and not words[1].isdigit():
                    await errorMessage(f'Please follow this format: {PREFIX}blacklist [@user]',
                                       message.channel)
                    return

            if len(message.mentions) != 0:
                id = message.mentions[0].id
            else:
                id = int(words[1])

            await adminCommands.blacklist(id, message.channel)

        # =====================================================

        elif (loweredMsg.startswith(f'{PREFIX}approve') or
              loweredMsg.startswith(f'{PREFIX}accept')) and isStaff:
            if len(words) < 2 or not words[1].isdigit():
                await errorMessage(f'Please follow this format: {PREFIX}approve [vouch ID]',
                                   message.channel)
                return

            ids = [int(i) for i in words[1:] if i.isdigit()]
            logChannel = self.get_channel(config.LOG_CHANNEL_ID)
            for i in ids:
                await adminCommands.approve(i, message.channel,
                                            logChannel, self.get_user)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}deny') and isStaff:
            if len(words) < 2 or not words[1].isdigit():
                await errorMessage(f'Please follow this format: {PREFIX}deny [vouch ID]',
                                   message.channel)
                return

            ids = [int(i) for i in words[1:] if i.isdigit()]
            for i in ids:
                await adminCommands.deny(i, message.channel)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}help'):
            await userCommands.help(PREFIX,
                                    message.channel,
                                    isMaster)

        # =====================================================

        elif loweredMsg.startswith(f'{PREFIX}about'):
            await userCommands.about(message.channel, self.user.avatar_url)

        # =====================================================

def main():
    DiscordBot().run(config.DISCORD_TOKEN)

if __name__ == '__main__':
    main()

(config.py

DISCORD_TOKEN = 'OwOD'
PENDING_VOUCHES_CHANNELID = 105159912
LOG_CHANNEL_ID = 1051599

here is the error

File "c:\Users\ne\Desktop\test bot\main.py", line 348, in main
    DiscordBot().run(config.DISCORD_TOKEN)
  File "c:\Users\ne\Desktop\test bot\main.py", line 19, in __init__
    self.masterIDs = allData['Masters']
KeyError: 'Masters'

I was expecting to work after changing some values but no solution


问:
How I can reformat dates to ISO format in my code?
I have a function which get data from database and reformat they in JSON file, but I need date fields was a ISO format - "dt": "2022-12-01T00:00:00". In code this fields named 'dt'.

```<code>    def table_to_json():
        db_connect = Database('database_name')
        query = '''SELECT * FROM table_name'''
        data = db_connect.get_query_result(query).fetchall()
        res = {'fields': {'data': []}}
        for obj in data:
            res['fields']['data'].append(
                {
                            'field_1': obj[1],
                            'dt': obj[0],
                            'field_2': obj[2],
                            'field_3': obj[3],
                            'field_4': obj[4],
                            'field_5': obj[5]
                        }
            )

        with open("my_file.json", "w") as file:
            json.dump(res, file)

</code>```

Im tryed use datetime.isoformat(obj[0]), but dates is str objects and isoformat() working with int and datetime formats how i understand.

Body:
I have a function which get data from database and reformat they in JSON file, but I need date fields was a ISO format - "dt": "2022-12-01T00:00:00". In code this fields named 'dt'.

    def table_to_json():
        db_connect = Database('database_name')
        query = '''SELECT * FROM table_name'''
        data = db_connect.get_query_result(query).fetchall()
        res = {'fields': {'data': []}}
        for obj in data:
            res['fields']['data'].append(
                {
                            'field_1': obj[1],
                            'dt': obj[0],
                            'field_2': obj[2],
                            'field_3': obj[3],
                            'field_4': obj[4],
                            'field_5': obj[5]
                        }
            )

        with open("my_file.json", "w") as file:
            json.dump(res, file)

Im tryed use datetime.isoformat(obj[0]), but dates is str objects and isoformat() working with int and datetime formats how i understand.


问:
[Python][Selenium] One window handle, two chrome tab. Is it possible? I can't crawl it
This is Some website crawling project using python+selenium.

I clicked this link in A tab of chrome and the window handle of this tab is 'AAA'.
onclick="fn_VirtualLogin('@StoreID@','G','StoreName');">

After click, new tab opened but there is no window handle.
when I print 'drive.window_handles', Just only 'AAA'. although I can see the two tab on browser in my eyes.

This is not work because of only one handle.
'drv.switch_to.window(drv.window_handles[1])'

I guess the tab on this website inherit the handles of second tab. That's why I believe two tabs share one handle. How can this be solved? I can't have access to the second tab with Selenium.

Body:
This is Some website crawling project using python+selenium.

I clicked this link in A tab of chrome and the window handle of this tab is 'AAA'.

After click, new tab opened but there is no window handle.
when I print 'drive.window_handles', Just only 'AAA'. although I can see the two tab on browser in my eyes.

This is not work because of only one handle.
'drv.switch_to.window(drv.window_handles[1])'

I guess the tab on this website inherit the handles of second tab. That's why I believe two tabs share one handle. How can this be solved? I can't have access to the second tab with Selenium.


问:
Try catch block not working in testng framework, its stoping execution after recieving exception
```<code>driver.findElement(By.xpath("(//span[.='Add to Cart'])[1]")).click();
    Thread.sleep(2000);
    driver.findElement(By.xpath("//div[@id='nav-cart-text-container']")).click();
    Thread.sleep(2000);
    driver.findElement(By.xpath("//input[@name='proceedToRetailCheckout']")).click();
    Thread.sleep(2000);
    try
       {
           driver.findElement(By.xpath("//button[@id='primepanel_nothanks-truespc']")).click();
       }catch(NoSuchElementException ne) {
           System.out.println("no popup of prime ad");
           ne.printStackTrace();
       }
    Thread.sleep(6000);
   try {
    WebElement dur = driver.findElement(By.xpath("//div[@class='a-row duration-and-due-date-of-rental-widget']"));
    System.out.println("due date is present in final place your order page"+"---"+dur.isDisplayed());
    System.out.println("about due date :-"+dur.getText());
   }
   catch(NoSuchElementException ne){
       System.out.println("due date not present");
       ne.printStackTrace();
   }

    WebElement pri = driver.findElement(By.xpath("//span[@data-testid='Product_price 0_0_0']"));
   boolean prr = pri.isDisplayed();
   System.out.println("price is present in final place your order page"+"---"+prr);
    System.out.println("rental price is :-"+pri.getText());
</code>```

here one popup will come but not everytime so thats why  i mention try catch in that , if that element is not present it should execute next line but its not executing why? actually it was worked fine from 1month , now its not working

Body:
driver.findElement(By.xpath("(//span[.='Add to Cart'])[1]")).click();
    Thread.sleep(2000);
    driver.findElement(By.xpath("//div[@id='nav-cart-text-container']")).click();
    Thread.sleep(2000);
    driver.findElement(By.xpath("//input[@name='proceedToRetailCheckout']")).click();
    Thread.sleep(2000);
    try
       {
           driver.findElement(By.xpath("//button[@id='primepanel_nothanks-truespc']")).click();
       }catch(NoSuchElementException ne) {
           System.out.println("no popup of prime ad");
           ne.printStackTrace();
       }
    Thread.sleep(6000);
   try {
    WebElement dur = driver.findElement(By.xpath("//div[@class='a-row duration-and-due-date-of-rental-widget']"));
    System.out.println("due date is present in final place your order page"+"---"+dur.isDisplayed());
    System.out.println("about due date :-"+dur.getText());
   }
   catch(NoSuchElementException ne){
       System.out.println("due date not present");
       ne.printStackTrace();
   }

    WebElement pri = driver.findElement(By.xpath("//span[@data-testid='Product_price 0_0_0']"));
   boolean prr = pri.isDisplayed();
   System.out.println("price is present in final place your order page"+"---"+prr);
    System.out.println("rental price is :-"+pri.getText());

here one popup will come but not everytime so thats why  i mention try catch in that , if that element is not present it should execute next line but its not executing why? actually it was worked fine from 1month , now its not working


问:
How to add more routes in laravel auth 9 template
I m trying to make a small application, I have used laravel auth/ui for the authentication, now i don't really understand how the built-in routes are working and how should I add new routes.

I m working on laravel 9
`

```<code>Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

Auth::routes();

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

Auth::routes();

Route::post('/home', [App\Http\Controllers\HomeController::class, 'store'])->name('home');

</code>```

`
I have add this route but I m unable to execute store function in my home controller

Body:
I m trying to make a small application, I have used laravel auth/ui for the authentication, now i don't really understand how the built-in routes are working and how should I add new routes.

I m working on laravel 9
`

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

Auth::routes();

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

Auth::routes();

Route::post('/home', [App\Http\Controllers\HomeController::class, 'store'])->name('home');

`
I have add this route but I m unable to execute store function in my home controller


问:
How does ActiveDirectoryLdapAuthenticationProvider work without explicitly specifying user credentials?
Following is a typical example of what I've found on the Internet for Authenticating to Active Directory using LDAP.

```<code>package com.test;

import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider;

@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        ActiveDirectoryLdapAuthenticationProvider adProvider = new ActiveDirectoryLdapAuthenticationProvider("domain.org",
                "ldap://activedirectory-url:389");
        adProvider.setConvertSubErrorCodesToExceptions(true);
        adProvider.setUseAuthenticationRequestCredentials(true);
        auth.authenticationProvider(adProvider);
    }

}
</code>```

Let's say I have a user XYZ with password 123 which I enter into the login form. How would this security configuration pickup my credentials and verify them against the Active Directory server?

Why does Active Directory not require a ManagerDn, ManagerPassword, or Username or Userpassword. I fail to understand how it would Authenticate without the aforementioned information.

Normally with ldapAuthentication I would provide such details in the ContextSource, like so:

but I can't seem to find how do this with ActiveDirectoryLdapAuthenticationProvider .

I checked the class's documentation and was unable to understand how it receives and processes the userCredentials

Body:
Following is a typical example of what I've found on the Internet for Authenticating to Active Directory using LDAP.

package com.test;

import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider;

@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        ActiveDirectoryLdapAuthenticationProvider adProvider = new ActiveDirectoryLdapAuthenticationProvider("domain.org",
                "ldap://activedirectory-url:389");
        adProvider.setConvertSubErrorCodesToExceptions(true);
        adProvider.setUseAuthenticationRequestCredentials(true);
        auth.authenticationProvider(adProvider);
    }

}

Let's say I have a user XYZ with password 123 which I enter into the login form. How would this security configuration pickup my credentials and verify them against the Active Directory server?

Why does Active Directory not require a ManagerDn, ManagerPassword, or Username or Userpassword. I fail to understand how it would Authenticate without the aforementioned information.

Normally with ldapAuthentication I would provide such details in the ContextSource, like so:

but I can't seem to find how do this with ActiveDirectoryLdapAuthenticationProvider .

I checked the class's documentation and was unable to understand how it receives and processes the userCredentials


问:
pdf text changes text when uploaded to website
We have a 30 page PDF that is looking great (pictures, etc...), but when uploaded to a website, the heading

Appendices

changes to

$SSHQGLFHV

The same happens when I open the document in Google Docs and when I copy the text! Is this an encoding issue?


问:
Severs stuck at discovery in Neo4J after setting cluster is done and running the servers
Server 1 discovery port: 5000
server 2 discovery port: 5001
server 3 discovery port: 5002

More information is also available at: https://neo4j.com/licensing/

2022-12-16 04:18:17.575+0000 WARN  Use of deprecated setting 'dbms.windows_service_name'. It is replaced by 'server.windows_service_name'.
2022-12-16 04:18:17.575+0000 WARN  Use of deprecated setting 'dbms.memory.pagecache.size'. It is replaced by 'server.memory.pagecache.size'.
2022-12-16 04:18:17.575+0000 WARN  Use of deprecated setting 'dbms.memory.heap.max_size'. It is replaced by 'server.memory.heap.max_size'.
2022-12-16 04:18:17.579+0000 WARN  Use of deprecated setting 'dbms.memory.heap.initial_size'. It is replaced by 'server.memory.heap.initial_size'.
2022-12-16 04:18:17.579+0000 INFO  Starting...
2022-12-16 04:18:19.865+0000 INFO  ======== Neo4j 5.2.0 ========
2022-12-16 04:18:19.905+0000 INFO  This instance is ServerId{945c47e8} (945c47e8-5dd4-42d5-9a9a-580a3a26df42)
2022-12-16 04:19:21.691+0000 INFO  Restarting discovery system after probable network partition
2022-12-16 04:19:22.650+0000 INFO  Successfully restarted discovery system
2022-12-16 04:20:22.652+0000 INFO  Restarting discovery system after probable network partition
2022-12-16 04:20:23.724+0000 INFO  Successfully restarted discovery system
2022-12-16 04:21:23.755+0000 INFO  Restarting discovery system after probable network partition
2022-12-16 04:21:23.910+0000 INFO  Successfully restarted discovery system
2022-12-16 04:22:23.929+0000 INFO  Restarting discovery system after probable network partition
2022-12-16 04:22:24.039+0000 INFO  Successfully restarted discovery system

I am expecting following:
Discovered core number at localhost 5000
Discovered core number at localhost 5001
Discovered core number at localhost 5002
Server thread metrics have been registered successfully
Remote interface available at http://ip:port/


问:
Metrics from Google Analytics Custom Report and Google Analytics Python API don't match. There is difference in the metric's value
I am unable to get the exact value from a Google Analytics Custom Report through Python API. Users metric is 1013,523 in the GA Custom report by Python API returns 102,4972.

I believe I am not using REGEX correctly in the first filter. Can someone please tell me if I have done it incorrectly?

```<code>http = credentials.authorize(httplib2.Http())
service = build('analytics', 'v4', http=http, discoveryServiceUrl=('https://analyticsreporting.googleapis.com/$discovery/rest'))
response = service.reports().batchGet(
    body={
        'reportRequests': [
            {
                'viewId': 'XXX',
                'dateRanges': [{'startDate': '2022-12-04', 'endDate': '2022-12-10'}],
                'metrics': [{'expression': 'ga:users'}],
                'dimensions': [{"name": "ga:week"},{"name":"ga:country"}],
                "dimensionFilterClauses": [
                                        {
                                            "filters": [
                                            {
                                              "dimensionName": "ga:pagePath",
                                              "operator": "REGEXP",
                                              "expressions": ["www\.test\.com|my\.test.com\/upgrade"]
                                            }
                                          ]
                                        },
                                        {
                                          "filters": [
                                            {
                                              "dimensionName": "ga:country",
                                              "operator": "EXACT",
                                              "expressions": ["United States"]
                                            }
                                          ]
                                        },
                                        {
                                            "filters": [
                                            {
                                              "dimensionName": "ga:pagePath",
                                              "not":1,
                                              "operator": "REGEXP",
                                              "expressions": ["blog"]
                                            }
                                          ]
                                        }
                                      ]
        }]
}
).execute()
</code>```

This is how the filter is set on Google Analytics Custom Reports -

This is how the report looks like in Google Analytics -

Body:
I am unable to get the exact value from a Google Analytics Custom Report through Python API. Users metric is 1013,523 in the GA Custom report by Python API returns 102,4972.

I believe I am not using REGEX correctly in the first filter. Can someone please tell me if I have done it incorrectly?

http = credentials.authorize(httplib2.Http())
service = build('analytics', 'v4', http=http, discoveryServiceUrl=('https://analyticsreporting.googleapis.com/$discovery/rest'))
response = service.reports().batchGet(
    body={
        'reportRequests': [
            {
                'viewId': 'XXX',
                'dateRanges': [{'startDate': '2022-12-04', 'endDate': '2022-12-10'}],
                'metrics': [{'expression': 'ga:users'}],
                'dimensions': [{"name": "ga:week"},{"name":"ga:country"}],
                "dimensionFilterClauses": [
                                        {
                                            "filters": [
                                            {
                                              "dimensionName": "ga:pagePath",
                                              "operator": "REGEXP",
                                              "expressions": ["www\.test\.com|my\.test.com\/upgrade"]
                                            }
                                          ]
                                        },
                                        {
                                          "filters": [
                                            {
                                              "dimensionName": "ga:country",
                                              "operator": "EXACT",
                                              "expressions": ["United States"]
                                            }
                                          ]
                                        },
                                        {
                                            "filters": [
                                            {
                                              "dimensionName": "ga:pagePath",
                                              "not":1,
                                              "operator": "REGEXP",
                                              "expressions": ["blog"]
                                            }
                                          ]
                                        }
                                      ]
        }]
}
).execute()

This is how the filter is set on Google Analytics Custom Reports -

This is how the report looks like in Google Analytics -


问:
Array.slice() for Pagination
I'm trying to create a pagination function with JavaScript, to implement something like what is in the Figma design in that picture. I have gotten to the point where I get the first 1 to 5 list from the first Array.slice method.

Now I want to update the slice first and last inputs when I click on Next so that it can update from (1 to 5) to (6 to 10). The value changes but it doesn't affect the array I output in the list. How can I solve this problem please?

```<code>// For Pagination
let currentPage = 1;
let postsPerPage = 10;
let lastPage = 5;
let indexOfLastPost = currentPage * lastPage;
let indexOfFirstPost = indexOfLastPost - lastPage;
let pageNumberSelector = document.getElementById("pageNumbers");

let pageNumbers = [];
let currentPageNumbers = [];

for (let i = 1; i <= Math.ceil(150 / postsPerPage); i++) {
  pageNumbers.push(i);
}
const getCurrentPageNumbers = (firstSliceValue = 0, lastSliceValue = 5) => {
  currentPageNumbers.push(
    pageNumbers.slice(firstSliceValue, lastSliceValue)
  );
};

getCurrentPageNumbers();

pageNumberSelector.innerHTML = `<p id='prevPageBtn'>Previous</p>
<ul>
 <li>
  <a href='/'>${currentPageNumbers}</a>
 </li>
</ul>
<p id='nextPageBtn'>Next</p>`;

const nextPageBtn = document.getElementById("nextPageBtn");

nextPageBtn.addEventListener("click", () => {
  indexOfLastPost = indexOfLastPost + 5;
  indexOfFirstPost = indexOfFirstPost + 5;
  getCurrentPageNumbers(indexOfFirstPost, indexOfLastPost);
  console.log(indexOfFirstPost, indexOfLastPost);
});
</code>```

Pagination design:

Title: Array.slice() for Pagination

Body:
I'm trying to create a pagination function with JavaScript, to implement something like what is in the Figma design in that picture. I have gotten to the point where I get the first 1 to 5 list from the first Array.slice method.

Now I want to update the slice first and last inputs when I click on Next so that it can update from (1 to 5) to (6 to 10). The value changes but it doesn't affect the array I output in the list. How can I solve this problem please?

// For Pagination
let currentPage = 1;
let postsPerPage = 10;
let lastPage = 5;
let indexOfLastPost = currentPage * lastPage;
let indexOfFirstPost = indexOfLastPost - lastPage;
let pageNumberSelector = document.getElementById("pageNumbers");

let pageNumbers = [];
let currentPageNumbers = [];

for (let i = 1; i <= Math.ceil(150 / postsPerPage); i++) {
  pageNumbers.push(i);
}
const getCurrentPageNumbers = (firstSliceValue = 0, lastSliceValue = 5) => {
  currentPageNumbers.push(
    pageNumbers.slice(firstSliceValue, lastSliceValue)
  );
};

getCurrentPageNumbers();

pageNumberSelector.innerHTML = `
Previous

  ${currentPageNumbers}

Next
`;

const nextPageBtn = document.getElementById("nextPageBtn");

nextPageBtn.addEventListener("click", () => {
  indexOfLastPost = indexOfLastPost + 5;
  indexOfFirstPost = indexOfFirstPost + 5;
  getCurrentPageNumbers(indexOfFirstPost, indexOfLastPost);
  console.log(indexOfFirstPost, indexOfLastPost);
});

Pagination design:


问:
Android studio intent malfunction
I am trying to create a project where you move to the quiz application of the project after you login, but the intent part doesnt work and the application keeps closing after u input the correct
username and password ,it never moves to the next part of the project.

this is my code

```<code>public class MainActivity extends AppCompatActivity {
    TextView loginview;
    Button login;
    EditText name, pass;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

//         Intent intent = new Intent(MainActivity.this, LandingPage.class);
//                    intent.putExtra("username","Admin");
//                    startActivity(intent);
        loginview = findViewById(R.id.textview);
        name = findViewById(R.id.editText);
        pass = findViewById(R.id.editText2);

        login = findViewById(R.id.button);

        login.setOnClickListener(v -> {
            if (name.getText().toString().equals("admin") && pass.getText().toString().equals("pass")) {
                Toast.makeText(getApplicationContext(), "Login success", Toast.LENGTH_LONG).show();
               ** Intent intent = new Intent(MainActivity.this, MainActivity2.class);
                name.setText("");
                startActivity(intent);**

            } else {
                Toast.makeText(getApplicationContext(), "Login unsuccessfull", Toast.LENGTH_LONG).show();
            }
        });
    }
}

*part of Mainactivity 2*``

ackage com.example.quizapplicationfinal;

import androidx.appcompat.app.AppCompatActivity;

import android.app.AlertDialog;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity2 extends AppCompatActivity implements View.OnClickListener{

    TextView totalQuestionsTextView;
    TextView questionTextView;
    Button ansA, ansB, ansC, ansD;
    Button submitBtn;

    int score=0;
    int totalQuestion = QuestionAnswer.question.length;
    int currentQuestionIndex = 0;
    String selectedAnswer = "";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent=getIntent();
        setContentView(R.layout.activity_main);
`
</code>```

Title: Android studio intent malfunction

Body:
I am trying to create a project where you move to the quiz application of the project after you login, but the intent part doesnt work and the application keeps closing after u input the correct
username and password ,it never moves to the next part of the project.

this is my code

public class MainActivity extends AppCompatActivity {
    TextView loginview;
    Button login;
    EditText name, pass;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

//         Intent intent = new Intent(MainActivity.this, LandingPage.class);
//                    intent.putExtra("username","Admin");
//                    startActivity(intent);
        loginview = findViewById(R.id.textview);
        name = findViewById(R.id.editText);
        pass = findViewById(R.id.editText2);

        login = findViewById(R.id.button);

        login.setOnClickListener(v -> {
            if (name.getText().toString().equals("admin") && pass.getText().toString().equals("pass")) {
                Toast.makeText(getApplicationContext(), "Login success", Toast.LENGTH_LONG).show();
               ** Intent intent = new Intent(MainActivity.this, MainActivity2.class);
                name.setText("");
                startActivity(intent);**

            } else {
                Toast.makeText(getApplicationContext(), "Login unsuccessfull", Toast.LENGTH_LONG).show();
            }
        });
    }
}

*part of Mainactivity 2*``

ackage com.example.quizapplicationfinal;

import androidx.appcompat.app.AppCompatActivity;

import android.app.AlertDialog;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity2 extends AppCompatActivity implements View.OnClickListener{

    TextView totalQuestionsTextView;
    TextView questionTextView;
    Button ansA, ansB, ansC, ansD;
    Button submitBtn;

    int score=0;
    int totalQuestion = QuestionAnswer.question.length;
    int currentQuestionIndex = 0;
    String selectedAnswer = "";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent=getIntent();
        setContentView(R.layout.activity_main);
`


问:
Running an R code cell in the same Jupyter Notebook on DataSpell?
I'm new to R, still new to Jupyter Notebooks in many respects.

I was wondering if DataSpell had a way to run Python and R code cells in the same Jupyter notebook. Does DataSpell allow this on its own, or is there a library that I have to import in R or Python or am I fundamentally misunderstanding how Jupyter notebooks are supposed to work?


问:
Trackpad not working as expected for horizontal scroll
I've got the little bit of below code running horizontal scroll on 2 pages on my website

```<code><script>
        // mouse wheel horizontal scroll
        const scrollContainer = document.querySelector("main");

        scrollContainer.addEventListener("wheel", (evt) => {
            evt.preventDefault();
            scrollContainer.scrollLeft += evt.deltaY;
        });
    </script>
</code>```

The issue is that when you are using a trackpad, your first thought is to move sideways, but as it is currently you have to move up and down to scroll horizontal.

Is there aa way to turn this off for if someone is using a trackpad? Or any alternative suggestions?

Bonus if it can be turned of for mobile display size, as horizontal isn't used here. Touch screen scrolling works but if you are using a scroll wheel it doesn't scroll up and down becasue of this code. (Realise it's very unlikily anyone would be using a mouse at tablet mobile screen sizes)

I'm expecting the trackpad to be able to move left to right and scroll through horizontally, while still keeping scroll wheel working horizontal, but only on two pages of the website.

Body:
I've got the little bit of below code running horizontal scroll on 2 pages on my website

The issue is that when you are using a trackpad, your first thought is to move sideways, but as it is currently you have to move up and down to scroll horizontal.

Is there aa way to turn this off for if someone is using a trackpad? Or any alternative suggestions?

Bonus if it can be turned of for mobile display size, as horizontal isn't used here. Touch screen scrolling works but if you are using a scroll wheel it doesn't scroll up and down becasue of this code. (Realise it's very unlikily anyone would be using a mouse at tablet mobile screen sizes)

I'm expecting the trackpad to be able to move left to right and scroll through horizontally, while still keeping scroll wheel working horizontal, but only on two pages of the website.


问:
How to show in Auth::user() custom fields of User model?
On laravel 9.19, laravel/passport": "^11.3 site
I added some more custom fields into users table, and making login method with code like :

```<code>public function login(Request $request)
{
    if(Auth::attempt(['email' => $request->email, 'password' => $request->password])){
        $user = Auth::user();
        $success['token'] =  $user->createToken('MyApp')->accessToken;
        $success['name'] =  $user->name;
        return $this->sendResponse($success, 'User login successfully.');
    }
    else{
        return $this->sendError('Unauthorised.', ['error'=>'Unauthorised']);
    }
}
</code>```

When I read logged user :

```<code>$user  = Auth::user();
\Log::info($user);
</code>```

$user has no my custom fields.
Just common app/Models/User.php :

```<code><?php

namespace App\Models;

// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens, HasFactory, Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'name',
        'email',
        'password',
    ];

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var array<int, string>
     */
    protected $hidden = [
        'password',
        'remember_token',
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array<string, string>
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];

}
</code>```

How have I to define my custom fields ?

```<code>"laravel/framework": "^9.19",
"laravel/passport": "^11.3",

</code>```

Thanks in advance!

Body:
On laravel 9.19, laravel/passport": "^11.3 site
I added some more custom fields into users table, and making login method with code like :

public function login(Request $request)
{
    if(Auth::attempt(['email' => $request->email, 'password' => $request->password])){
        $user = Auth::user();
        $success['token'] =  $user->createToken('MyApp')->accessToken;
        $success['name'] =  $user->name;
        return $this->sendResponse($success, 'User login successfully.');
    }
    else{
        return $this->sendError('Unauthorised.', ['error'=>'Unauthorised']);
    }
}

When I read logged user :

$user  = Auth::user();
\Log::info($user);

$user has no my custom fields.
Just common app/Models/User.php :

<?php

namespace App\Models;

// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens, HasFactory, Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'name',
        'email',
        'password',
    ];

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var array<int, string>
     */
    protected $hidden = [
        'password',
        'remember_token',
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array<string, string>
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];

}

How have I to define my custom fields ?

"laravel/framework": "^9.19",
"laravel/passport": "^11.3",

Thanks in advance!


问:
Issue with running selenium scripts in headless browser in gitlab CI beacuse of chrome extension involvement
I have an automation test suite which includes the browser extension loading. I want to run these tests in gitlab but as far as I read, the headless chrome does not support the chrome extensions.

I can't use mozilla firefox as the extension is not supported by firefox. Please suggest me a way so that I can run my tests with the extension in gitlab CI.

Thanks in advance!

While looking for the solutions, I read about xvfb virtual display. I don't know what is it or will it work in gitlab. I tried but it did not work.


问:
How do we find the installed mysql component list from a mysql server running machine?
I want to find the installed mysql component list (i.e: Server:Optimizer, Server:Connection Handling, etc...)  for CVE evaluations. Are there any place in the mysql installed machine to find the installed mysql components/ sub components list?</p>


问:
How to fix 'failed due to obsolete coordinator information: This is not the correct coordinator for this group'
Yesterday I restarted the kafka broker, but after the restart, a large number of consumer groups have problems, reporting failed due to obsolete coordinator information: This is not the correct coordinator for this group.

The state of the consumer group before I restarted

after i reboot

Like losing data, how can these groups be reused? Thanks.

kafka version:0.11.0-IV2 (0.11.0.3)


问:
Filter related to deferent year month in java
Here only the recode related to the month is filtered. I want to filter related to deferent year month how can I do it?

The type of lastUpdatedTs filed type is OffsetDateTime

```<code>final List<BillingRecord> billingRecords = billingService.findAllRecords(employerId,
      query, includeDrafts);

    final Map<Month, BillingRecord> groupByMonthSelectedLastUpdated = billingRecords.stream().
            collect(Collectors.toMap(BillingRecord::getMonth,
                    Function.identity(),
                    (BillingRecord d1, BillingRecord d2) -> d1.getLastUpdatedTs().isAfter(d2.getLastUpdatedTs()) ? d1 : d2));
</code>```

Below is the BillingRecord class

```<code>import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.Month;
import java.util.EnumMap;
import java.util.Map;
import lombok.*;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/* Billing Record collection */
@Document(collection = "billing-records")
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@Builder
public class BillingRecord extends BasicAuditSupport {
  @Indexed private String employerId;
  @Indexed private BillingFileType fileType;
  private Month month;
  private int year;
  private RecordStatus status;
  private BigDecimal monthlyTotal;
  private boolean publishedOnce;

  @Builder.Default
  private Map<BillingFileType, S3DocumentDetails> files = new EnumMap<>(BillingFileType.class);

  private LocalDate billingDate;
}
</code>```

Body:
Here only the recode related to the month is filtered. I want to filter related to deferent year month how can I do it?

The type of lastUpdatedTs filed type is OffsetDateTime

final List<BillingRecord> billingRecords = billingService.findAllRecords(employerId,
      query, includeDrafts);

    final Map<Month, BillingRecord> groupByMonthSelectedLastUpdated = billingRecords.stream().
            collect(Collectors.toMap(BillingRecord::getMonth,
                    Function.identity(),
                    (BillingRecord d1, BillingRecord d2) -> d1.getLastUpdatedTs().isAfter(d2.getLastUpdatedTs()) ? d1 : d2));

Below is the BillingRecord class

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.Month;
import java.util.EnumMap;
import java.util.Map;
import lombok.*;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/* Billing Record collection */
@Document(collection = "billing-records")
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@Builder
public class BillingRecord extends BasicAuditSupport {
  @Indexed private String employerId;
  @Indexed private BillingFileType fileType;
  private Month month;
  private int year;
  private RecordStatus status;
  private BigDecimal monthlyTotal;
  private boolean publishedOnce;

  @Builder.Default
  private Map<BillingFileType, S3DocumentDetails> files = new EnumMap<>(BillingFileType.class);

  private LocalDate billingDate;
}


问:
Firebase Analytics params as a object
I am passing event.params as json string. But the value not reflecting in google big query.

Here screen and name is coming in big query.

```<code>const params = {
      screen: screen,
      name:name,
      event_params: JSON.stringify({
        source: source,
        user_id: user_id,
      }),
 }

</code>```
```<code>this._logEvent(EventValues.ScreenView, params)
</code>```

I can see in the  browser network  data is passing.

Before i tried without stringify also, its not working

Title: Firebase Analytics params as a object

Body:
I am passing event.params as json string. But the value not reflecting in google big query.

Here screen and name is coming in big query.

const params = {
      screen: screen,
      name:name,
      event_params: JSON.stringify({
        source: source,
        user_id: user_id,
      }),
 }

this._logEvent(EventValues.ScreenView, params)

I can see in the  browser network  data is passing.

Before i tried without stringify also, its not working


问:
How to add tags to image uploaded to imgur api from python?
I am programming a bot so that I can upload local images to my Imgur account, but I also want to add tags of each image from Python

Here is my code:

import requests
import base64

headers1 = {'Authorization': 'Bearer Xxxx',}
params = {
        'title':f'uwu',
        'description':'hello',
        'name':'Hey',
        'add_tags':'Fortnite',

        'image': base64.b64encode(open('cosmetico.png', 'rb').read())}
r = requests.post(f'https://api.imgur.com/3/image', headers=headers1, data=params)
data = r.json()["data"]["link"]
id = r.json()["data"]["id"]
```

I have tried to add add_tags or tags but none work.

I would like to be able to add the tags:

But I can't find a way to do it.

Body:
I am programming a bot so that I can upload local images to my Imgur account, but I also want to add tags of each image from Python

Here is my code:

import requests
import base64

headers1 = {'Authorization': 'Bearer Xxxx',}
params = {
        'title':f'uwu',
        'description':'hello',
        'name':'Hey',
        'add_tags':'Fortnite',

        'image': base64.b64encode(open('cosmetico.png', 'rb').read())}
r = requests.post(f'https://api.imgur.com/3/image', headers=headers1, data=params)
data = r.json()["data"]["link"]
id = r.json()["data"]["id"]

I have tried to add add_tags or tags but none work.

I would like to be able to add the tags:

But I can't find a way to do it.


问:
The difference between MySQL Workbench and MySQL client
I have installed both MySQL Workbench and MySQL client console (Using Ubuntu WSL).
When I tried to connect to MySQL Server and query.
The MySQL Workbench returns typically but the MySQL client returns with errors:

```<code>ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    56993
Current database: *** NONE ***
</code>```

I don't know the difference between the 2 versions. How can I config MySQL client to Query regularly like MySQL Workbench?

NOTE: It's the same issue when I use mysql-connector-python.

Body:
I have installed both MySQL Workbench and MySQL client console (Using Ubuntu WSL).
When I tried to connect to MySQL Server and query.
The MySQL Workbench returns typically but the MySQL client returns with errors:

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    56993
Current database: *** NONE ***

I don't know the difference between the 2 versions. How can I config MySQL client to Query regularly like MySQL Workbench?

NOTE: It's the same issue when I use mysql-connector-python.


问:
Eclipse RCP product export: Cannot satisfy slf4j dependency
I am building existing RCP application against this target platform:

The PDE build worked fine just few weeks ago and then something happened, presumably Eclipse updated itself? or something like this.. Now I am getting this dependency error which makes no sense because by the look of it the required plugin and exported package is present in the target platform. If I disable p2 "Generate p2 repository" in the export dialog, the build works fine.

```<code>Property "p2.director.log" has not been set
[p2.director] Installing com.myclient.product 5.2.0.
[p2.director] Installation failed.
[p2.director] Cannot complete the install because one or more required items could not be found.
[p2.director]   Software being installed: logFaces 5.2.0 (com.myclient.product 5.2.0)
[p2.director]   Missing requirement: Apache HttpClient 5.1.2.v20211217-1500 (org.apache.httpcomponents.client5.httpclient5 5.1.2.v20211217-1500) requires 'java.package; org.slf4j [1.7.25,2.0.0)' but it could not be found
[p2.director]   Cannot satisfy dependency:
[p2.director]       From: logFaces 5.2.0 (com.myclient.product 5.2.0)
[p2.director]       To: org.eclipse.equinox.p2.iu; org.eclipse.equinox.p2.core.feature.feature.group [1.6.1300.v20220223-1131,1.6.1300.v20220223-1131]
[p2.director]   Cannot satisfy dependency:
[p2.director]       From: ECF Apache Httpclient 5 FileTransfer Provider 1.1.600.v20220215-0126 (org.eclipse.ecf.filetransfer.httpclient5.feature.feature.group 1.1.600.v20220215-0126)
[p2.director]       To: org.eclipse.equinox.p2.iu; org.apache.httpcomponents.client5.httpclient5 [5.1.2.v20211217-1500,5.1.2.v20211217-1500]
[p2.director]   Cannot satisfy dependency:
[p2.director]       From: Equinox p2, headless functionalities 1.6.1300.v20220223-1131 (org.eclipse.equinox.p2.core.feature.feature.group 1.6.1300.v20220223-1131)
[p2.director]       To: org.eclipse.equinox.p2.iu; org.eclipse.ecf.filetransfer.httpclient5.feature.feature.group [1.0.0,2.0.0)
[p2.director] Cannot complete the install because one or more required items could not be found.
[p2.director] Software being installed: logFaces 5.2.0 (com.myclient.product 5.2.0)
[p2.director] Missing requirement: Apache HttpClient 5.1.2.v20211217-1500 (org.apache.httpcomponents.client5.httpclient5 5.1.2.v20211217-1500) requires 'java.package; org.slf4j [1.7.25,2.0.0)' but it could not be found
[p2.director] Cannot satisfy dependency:
[p2.director] Cannot satisfy dependency:
[p2.director] Cannot satisfy dependency:
A problem occured while invoking the director.
runDirector:  duration 0 seconds
</code>```

I would appreciate any help from the community on this one, thank you in advance!

Body:
I am building existing RCP application against this target platform:

The PDE build worked fine just few weeks ago and then something happened, presumably Eclipse updated itself? or something like this.. Now I am getting this dependency error which makes no sense because by the look of it the required plugin and exported package is present in the target platform. If I disable p2 "Generate p2 repository" in the export dialog, the build works fine.

Property "p2.director.log" has not been set
[p2.director] Installing com.myclient.product 5.2.0.
[p2.director] Installation failed.
[p2.director] Cannot complete the install because one or more required items could not be found.
[p2.director]   Software being installed: logFaces 5.2.0 (com.myclient.product 5.2.0)
[p2.director]   Missing requirement: Apache HttpClient 5.1.2.v20211217-1500 (org.apache.httpcomponents.client5.httpclient5 5.1.2.v20211217-1500) requires 'java.package; org.slf4j [1.7.25,2.0.0)' but it could not be found
[p2.director]   Cannot satisfy dependency:
[p2.director]       From: logFaces 5.2.0 (com.myclient.product 5.2.0)
[p2.director]       To: org.eclipse.equinox.p2.iu; org.eclipse.equinox.p2.core.feature.feature.group [1.6.1300.v20220223-1131,1.6.1300.v20220223-1131]
[p2.director]   Cannot satisfy dependency:
[p2.director]       From: ECF Apache Httpclient 5 FileTransfer Provider 1.1.600.v20220215-0126 (org.eclipse.ecf.filetransfer.httpclient5.feature.feature.group 1.1.600.v20220215-0126)
[p2.director]       To: org.eclipse.equinox.p2.iu; org.apache.httpcomponents.client5.httpclient5 [5.1.2.v20211217-1500,5.1.2.v20211217-1500]
[p2.director]   Cannot satisfy dependency:
[p2.director]       From: Equinox p2, headless functionalities 1.6.1300.v20220223-1131 (org.eclipse.equinox.p2.core.feature.feature.group 1.6.1300.v20220223-1131)
[p2.director]       To: org.eclipse.equinox.p2.iu; org.eclipse.ecf.filetransfer.httpclient5.feature.feature.group [1.0.0,2.0.0)
[p2.director] Cannot complete the install because one or more required items could not be found.
[p2.director] Software being installed: logFaces 5.2.0 (com.myclient.product 5.2.0)
[p2.director] Missing requirement: Apache HttpClient 5.1.2.v20211217-1500 (org.apache.httpcomponents.client5.httpclient5 5.1.2.v20211217-1500) requires 'java.package; org.slf4j [1.7.25,2.0.0)' but it could not be found
[p2.director] Cannot satisfy dependency:
[p2.director] Cannot satisfy dependency:
[p2.director] Cannot satisfy dependency:
A problem occured while invoking the director.
runDirector:  duration 0 seconds

I would appreciate any help from the community on this one, thank you in advance!


问:
How do I make my Cipher code read from a text file and cipher the text file?
This is my code
This is what my assignment was asking for my code

I'm trying to meet all the extra drills for my assignment but it asked for me to "Modify the code to read the plaintext message from a text file instead of letting the human type it in. Then, instead of just displaying the ciphertext on the screen, add code to store the ciphertext into a file."
and to "let the human type in the name of the file to encrypt and make the output filename based on the input filename."


问:
After calling update function in SQLite db, the data is not updated and returns 0 value
I'm trying to create a function which will update the password in the database. The function itself returns true value, however the data is not updated and remains the same. Also I changed the result of that long value and it returns 0. I'll very grateful for some suggestions on how to make it work correctly. Here's the code of the function:</p>
```<code>public Boolean changePassword(String name, String email, String password) {
        SQLiteDatabase DB = this.getWritableDatabase();
        ContentValues contentValues = new ContentValues();
        contentValues.put("name", name);
        contentValues.put("email", email);
        contentValues.put("password", password);
        Cursor cursor = DB.rawQuery("Select * from UserDetails where name = ? and email = ?", new String [] {name,email});
        if(cursor.getCount()>0) {
            long result = DB.update("UserDetails", contentValues, "password = ?", new String[] { password });

            System.out.println("Result= "+result);

            if (result == -1)
                return false;
             else
                return true;
        } else
            return false;
    }
</code>```

Body:
I'm trying to create a function which will update the password in the database. The function itself returns true value, however the data is not updated and remains the same. Also I changed the result of that long value and it returns 0. I'll very grateful for some suggestions on how to make it work correctly. Here's the code of the function:

public Boolean changePassword(String name, String email, String password) {
        SQLiteDatabase DB = this.getWritableDatabase();
        ContentValues contentValues = new ContentValues();
        contentValues.put("name", name);
        contentValues.put("email", email);
        contentValues.put("password", password);
        Cursor cursor = DB.rawQuery("Select * from UserDetails where name = ? and email = ?", new String [] {name,email});
        if(cursor.getCount()>0) {
            long result = DB.update("UserDetails", contentValues, "password = ?", new String[] { password });

            System.out.println("Result= "+result);

            if (result == -1)
                return false;
             else
                return true;
        } else
            return false;
    }