问:
get PG sql funnctions name from given query
our goal is to get pg sql inbuilt functions present in a query given by an user.

```<code>TablesNamesFinder tablesNamesFinder = new TablesNamesFinder(){
@Override
public void visit(Function function) {
    functionNames.add(function.getName().toLowerCase());
    super.visit(function);
}
@Override
public void visit(TableFunction valuesList) {
    functionNames.add(valuesList.getFunction().getName().toLowerCase());
    super.visit(valuesList);
}
};
</code>```

We have tried the above code but this will not give functions like

```<code>select current_user;
select current_schema;
</code>```

SO kindly help us to get all functions in given sql query

Body:
our goal is to get pg sql inbuilt functions present in a query given by an user.

TablesNamesFinder tablesNamesFinder = new TablesNamesFinder(){
@Override
public void visit(Function function) {
    functionNames.add(function.getName().toLowerCase());
    super.visit(function);
}
@Override
public void visit(TableFunction valuesList) {
    functionNames.add(valuesList.getFunction().getName().toLowerCase());
    super.visit(valuesList);
}
};

We have tried the above code but this will not give functions like

select current_user;
select current_schema;

SO kindly help us to get all functions in given sql query


来源: stackexchange

问:
Laravel 9: Query Builder: Sub Query Problems
I always built my own frameworks, so I know a lot of raw php. I thought I would learn Laravel 9 and make my first Laravel application.

I have solved my SQL sub query problem, after 4 hours but surely there is a better way.

I have a single table connected to multiple tables via linking tables and foreign keys. For example :

```<code>CREATE TABLE `video` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` text NOT NULL,
  `description` text,
  `producer_id` int(11) DEFAULT NULL,
  `production_date` date DEFAULT NULL,
  `link` text,
  `format` varchar(3) NOT NULL,
  `resolution` text,
  `local_filename` text,
  `local_path` text,
  `local_rating` tinyint(4) DEFAULT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `producer_id` (`producer_id`),
  CONSTRAINT `video_ibfk_1` FOREIGN KEY (`producer_id`) REFERENCES `producer` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2623 DEFAULT CHARSET=latin1
</code>```

connects to

```<code>CREATE TABLE `video_genre` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `video_id` int(11) NOT NULL,
  `genre_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `video_id` (`video_id`),
  KEY `genre_id` (`genre_id`),
  CONSTRAINT `video_genre_ibfk_1` FOREIGN KEY (`video_id`) REFERENCES `video` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
  CONSTRAINT `video_genre_ibfk_2` FOREIGN KEY (`genre_id`) REFERENCES `genre` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=38391 DEFAULT CHARSET=latin1
</code>```

connects to

```<code>CREATE TABLE `genre` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` text NOT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `pic_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `pic_id` (`pic_id`),
  CONSTRAINT `genre_ibfk_1` FOREIGN KEY (`pic_id`) REFERENCES `pic` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=297 DEFAULT CHARSET=latin1
</code>```

I have tried to use the query builder engine and found it impossible to do the query :

```<code>SELECT video.id, video.title
FROM video JOIN (
    SELECT video.id AS id, video.title, COUNT(genre.id) as genre_count
    FROM video
    INNER JOIN video_genre ON video.id = video_genre.video_id
    INNER JOIN genre ON video_genre.genre_id = genre.id
    WHERE genre.id IN (24,25)
    GROUP BY video.id
) as temp_table ON video.id = temp_table.id
WHERE genre_count = 2;
</code>```

as the sub query functions seems too limited : laravel doc

so with a sigh I resorted to raw sql in my controller :

```<code>$genres=implode(',',$genres=$request->post('g'));
$genres_count=count($request->post('g'));
$results = DB::select( DB::raw("
    SELECT video.id, video.title
    FROM video JOIN (
     SELECT video.id AS id, video.title, COUNT(genre.id) as genre_count
     FROM video
     INNER JOIN video_genre ON video.id = video_genre.video_id
     INNER JOIN genre ON video_genre.genre_id = genre.id
     WHERE genre.id IN ($genres)
     GROUP BY video.id
    ) as temp_table ON video.id = temp_table.id
    WHERE genre_count = $genres_count"));
return view('genre.show',['videos'=>$results]);

</code>```

I could not pass the variables to DB:select in array and using :vaiable_name, as they, I assume, get quoted or somehow mangled.

does someone know a better way, or the right way? Thank you experts in advance :)

footnote: Along the way while I was trying to use the query builder I lost an hour on using

```<code>->WhereIn('column_name',[1,2,3])->toSql();
</code>```

returns sql string 'WHERE column_name IN (?,?,?)' within. However the query is as expected, it uses [1,2,3] not [?,?,?] as stated; This a bug?

ContentLicense: CC BY-SA 4.0

Body:
I always built my own frameworks, so I know a lot of raw php. I thought I would learn Laravel 9 and make my first Laravel application.

I have solved my SQL sub query problem, after 4 hours but surely there is a better way.

I have a single table connected to multiple tables via linking tables and foreign keys. For example :

CREATE TABLE `video` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` text NOT NULL,
  `description` text,
  `producer_id` int(11) DEFAULT NULL,
  `production_date` date DEFAULT NULL,
  `link` text,
  `format` varchar(3) NOT NULL,
  `resolution` text,
  `local_filename` text,
  `local_path` text,
  `local_rating` tinyint(4) DEFAULT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `producer_id` (`producer_id`),
  CONSTRAINT `video_ibfk_1` FOREIGN KEY (`producer_id`) REFERENCES `producer` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2623 DEFAULT CHARSET=latin1

connects to

CREATE TABLE `video_genre` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `video_id` int(11) NOT NULL,
  `genre_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `video_id` (`video_id`),
  KEY `genre_id` (`genre_id`),
  CONSTRAINT `video_genre_ibfk_1` FOREIGN KEY (`video_id`) REFERENCES `video` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
  CONSTRAINT `video_genre_ibfk_2` FOREIGN KEY (`genre_id`) REFERENCES `genre` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=38391 DEFAULT CHARSET=latin1

connects to

CREATE TABLE `genre` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` text NOT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `pic_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `pic_id` (`pic_id`),
  CONSTRAINT `genre_ibfk_1` FOREIGN KEY (`pic_id`) REFERENCES `pic` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=297 DEFAULT CHARSET=latin1

I have tried to use the query builder engine and found it impossible to do the query :

SELECT video.id, video.title
FROM video JOIN (
    SELECT video.id AS id, video.title, COUNT(genre.id) as genre_count
    FROM video
    INNER JOIN video_genre ON video.id = video_genre.video_id
    INNER JOIN genre ON video_genre.genre_id = genre.id
    WHERE genre.id IN (24,25)
    GROUP BY video.id
) as temp_table ON video.id = temp_table.id
WHERE genre_count = 2;

as the sub query functions seems too limited : laravel doc

so with a sigh I resorted to raw sql in my controller :

$genres=implode(',',$genres=$request->post('g'));
$genres_count=count($request->post('g'));
$results = DB::select( DB::raw("
    SELECT video.id, video.title
    FROM video JOIN (
     SELECT video.id AS id, video.title, COUNT(genre.id) as genre_count
     FROM video
     INNER JOIN video_genre ON video.id = video_genre.video_id
     INNER JOIN genre ON video_genre.genre_id = genre.id
     WHERE genre.id IN ($genres)
     GROUP BY video.id
    ) as temp_table ON video.id = temp_table.id
    WHERE genre_count = $genres_count"));
return view('genre.show',['videos'=>$results]);

I could not pass the variables to DB:select in array and using :vaiable_name, as they, I assume, get quoted or somehow mangled.

does someone know a better way, or the right way? Thank you experts in advance :)

footnote: Along the way while I was trying to use the query builder I lost an hour on using

->WhereIn('column_name',[1,2,3])->toSql();

returns sql string 'WHERE column_name IN (?,?,?)' within. However the query is as expected, it uses [1,2,3] not [?,?,?] as stated; This a bug?


问:
Gradle task to initialise and take pull from submodule android
I have a project where it depends upon some other repo as submodule added to it.
As per the documentation of Git Submodule we run below commands

"git submodule update --init" to load the submodule

And going forward to take pull from submodule we run

" git submodule update --remote"

But running these command again and again is not convienient.

Is there any gradle task which can be written to first initialise the submodule if any and then take pull so that this manual dependency can be removed.


问:
Why MySQL hangs on this simple SELECT @nb, @id_start query?
I'm running a SQL script on a table with more than 80M+ rows.
I'm using a procedure to process batches of rows and I'm running it with a call to the mysql CLI client.

This procedure uses this simple SELECT @nb, @id_start query to output the progress.

I found out that the procedure stops progressing at some point.

Adminer shows this line:

Command
Time
State
Info

Query
28370
Sending to client
SELECT @nb, @id_start

=> My understanding is that this query has been running for 28370 seconds.

The SQL file I'm executing with the mysql CLI client is:

```<code>
DROP PROCEDURE IF EXISTS `LoopProcedure`;

DELIMITER $$
CREATE PROCEDURE LoopProcedure()
BEGIN
    SET @id_start := 24978724;

    SELECT @id_start := `cursor`
    FROM `temporary`
    WHERE `id` = 1;

    SET @nb := 0;
    loop_label: LOOP
        -- Select the max within the 1000 first rows
        SELECT @id_end := MAX(`emailId`)
        FROM (
            SELECT `emailId`
            FROM `BuyPacker_Email`
            WHERE `emailId` > @id_start
            ORDER BY `emailId`
            LIMIT 100
        ) as t;

        -- No more line found
        IF @id_end IS NULL OR @id_end = @id_start THEN
            LEAVE loop_label;
        END IF;
        -- Increment the counter
        SET @nb := (@nb + 100);

        -- Update these rows
        UPDATE `crm_contact`, `BuyPacker_Email`
        SET `crm_contact`.`email_status` = "VALID_EVENT"
        WHERE (`crm_contact`.`email_status` IN ("VALID", "NOT_VALID", "UNVERIFIED", "INVALID_SMTP") OR `crm_contact`.`email_status` IS NULL)
          AND `BuyPacker_Email`. `emailId` > @id_start
          AND `BuyPacker_Email`. `emailId` <= @id_end
          AND (`BuyPacker_Email`. `emailClick` IS NOT NULL OR `BuyPacker_Email`. `emailOpen` IS NOT NULL)
          AND `crm_contact`.`email` = `BuyPacker_Email`. `emailEmail`;

        UPDATE `email_list_recipient`, `BuyPacker_Email`
        SET `email_list_recipient`.`email_status` = "VALID_EVENT"
        WHERE `email_list_recipient`.`email_status` IN ("VALID", "NOT_VALID", "UNVERIFIED", "INVALID_SMTP")
          AND `BuyPacker_Email`. `emailId` > @id_start
          AND `BuyPacker_Email`. `emailId` <= @id_end
          AND (`BuyPacker_Email`. `emailClick` IS NOT NULL OR `BuyPacker_Email`. `emailOpen` IS NOT NULL)
          AND `BuyPacker_Email`. `emailEmail` COLLATE utf8mb4_unicode_ci = `email_list_recipient`.`email`;

        UPDATE `temporary`
        SET `cursor` = @id_start
        WHERE `id` = 1;

        -- Moving forward the cursor
        SET @id_start := @id_end;
        -- Output the progress
        SELECT @nb, @id_start;
        -- Cut some slack to the server to execute other statements
        DO SLEEP(0.2);

    END LOOP;
END$$
DELIMITER ;

CALL LoopProcedure();

DROP PROCEDURE `LoopProcedure`;
</code>```

My setup is:

The MySQL server is a Azure Database for MySQL Single Server

The MySQL CLI client is running on an Azure Container Instance

Both are within the same VNet

I expect this query to be always super fast, I don't understand why MySQL spends so much time on it.

Processing resumes if I kill this connection from Adminer and start a fresh MySQL CLI client command.

Body:
I'm running a SQL script on a table with more than 80M+ rows.
I'm using a procedure to process batches of rows and I'm running it with a call to the mysql CLI client.

This procedure uses this simple SELECT @nb, @id_start query to output the progress.

I found out that the procedure stops progressing at some point.

Adminer shows this line:

Command
Time
State
Info

Query
28370
Sending to client
SELECT @nb, @id_start

=> My understanding is that this query has been running for 28370 seconds.

The SQL file I'm executing with the mysql CLI client is:

DROP PROCEDURE IF EXISTS `LoopProcedure`;

DELIMITER $$
CREATE PROCEDURE LoopProcedure()
BEGIN
    SET @id_start := 24978724;

    SELECT @id_start := `cursor`
    FROM `temporary`
    WHERE `id` = 1;

    SET @nb := 0;
    loop_label: LOOP
        -- Select the max within the 1000 first rows
        SELECT @id_end := MAX(`emailId`)
        FROM (
            SELECT `emailId`
            FROM `BuyPacker_Email`
            WHERE `emailId` > @id_start
            ORDER BY `emailId`
            LIMIT 100
        ) as t;

        -- No more line found
        IF @id_end IS NULL OR @id_end = @id_start THEN
            LEAVE loop_label;
        END IF;
        -- Increment the counter
        SET @nb := (@nb + 100);

        -- Update these rows
        UPDATE `crm_contact`, `BuyPacker_Email`
        SET `crm_contact`.`email_status` = "VALID_EVENT"
        WHERE (`crm_contact`.`email_status` IN ("VALID", "NOT_VALID", "UNVERIFIED", "INVALID_SMTP") OR `crm_contact`.`email_status` IS NULL)
          AND `BuyPacker_Email`. `emailId` > @id_start
          AND `BuyPacker_Email`. `emailId` <= @id_end
          AND (`BuyPacker_Email`. `emailClick` IS NOT NULL OR `BuyPacker_Email`. `emailOpen` IS NOT NULL)
          AND `crm_contact`.`email` = `BuyPacker_Email`. `emailEmail`;

        UPDATE `email_list_recipient`, `BuyPacker_Email`
        SET `email_list_recipient`.`email_status` = "VALID_EVENT"
        WHERE `email_list_recipient`.`email_status` IN ("VALID", "NOT_VALID", "UNVERIFIED", "INVALID_SMTP")
          AND `BuyPacker_Email`. `emailId` > @id_start
          AND `BuyPacker_Email`. `emailId` <= @id_end
          AND (`BuyPacker_Email`. `emailClick` IS NOT NULL OR `BuyPacker_Email`. `emailOpen` IS NOT NULL)
          AND `BuyPacker_Email`. `emailEmail` COLLATE utf8mb4_unicode_ci = `email_list_recipient`.`email`;

        UPDATE `temporary`
        SET `cursor` = @id_start
        WHERE `id` = 1;

        -- Moving forward the cursor
        SET @id_start := @id_end;
        -- Output the progress
        SELECT @nb, @id_start;
        -- Cut some slack to the server to execute other statements
        DO SLEEP(0.2);

    END LOOP;
END$$
DELIMITER ;

CALL LoopProcedure();

DROP PROCEDURE `LoopProcedure`;

My setup is:

The MySQL server is a Azure Database for MySQL Single Server

The MySQL CLI client is running on an Azure Container Instance

Both are within the same VNet

I expect this query to be always super fast, I don't understand why MySQL spends so much time on it.

Processing resumes if I kill this connection from Adminer and start a fresh MySQL CLI client command.


问:
measuring forward backward tilt with CMMotionManager for Y-Axis plotting
Suppose you are holding an iphone/ipad vertically in front of you with the screen facing you, in portrait orientation. You tilt the device forward and backward keeping the screen facing you. I have the pitch value from CMMotion manager. I am facing issue with plotting  the value of Y-axis accurately to the movement.

```<code>func setUpGyro() {
        if motionManager.isGyroAvailable {
            motionManager.deviceMotionUpdateInterval = 0.1;
            motionManager.startDeviceMotionUpdates(to: OperationQueue.main, withHandler: {[weak self] (deviceMotion, NSError) -> Void in
                self?.updatePitchMotion(deviceMotion!)
            })
        } else {
            // gyro data is not available
        }
    }

private func updatePitchMotion(_ motion: CMDeviceMotion) {
        let pitch = Double(round(motion.attitude.pitch.rad2deg()))
        let maxDistance: CGFloat = 75 // line will not go over 75, as height of the superview is 150
        let currentDistance = pitch / 90.0 * maxDistance

        DispatchQueue.main.async {
            // plotGreen changes the color of the line to green as line is red by default
            pitch == -7 ? self.plotGreen() : self.plotRed()
            pitch == -8 ? self.plotGreen() : self.plotRed()
            pitch == -6 ? self.plotGreen() : self.plotRed()

            self.pitchIndicatorLine.transform = CGAffineTransform(translationX: 0, y: currentDistance)
            print(pitch)
        }
    }
</code>```

I'm getting results from the above code for pitchIndicatorLine but the screen is facing in the upward direction (horizontally) and not facing myself (vertically), can anyone please correct the code for the device to work vertically.
Note: I think its more of a logic issue.

Body:
Suppose you are holding an iphone/ipad vertically in front of you with the screen facing you, in portrait orientation. You tilt the device forward and backward keeping the screen facing you. I have the pitch value from CMMotion manager. I am facing issue with plotting  the value of Y-axis accurately to the movement.

func setUpGyro() {
        if motionManager.isGyroAvailable {
            motionManager.deviceMotionUpdateInterval = 0.1;
            motionManager.startDeviceMotionUpdates(to: OperationQueue.main, withHandler: {[weak self] (deviceMotion, NSError) -> Void in
                self?.updatePitchMotion(deviceMotion!)
            })
        } else {
            // gyro data is not available
        }
    }

private func updatePitchMotion(_ motion: CMDeviceMotion) {
        let pitch = Double(round(motion.attitude.pitch.rad2deg()))
        let maxDistance: CGFloat = 75 // line will not go over 75, as height of the superview is 150
        let currentDistance = pitch / 90.0 * maxDistance

        DispatchQueue.main.async {
            // plotGreen changes the color of the line to green as line is red by default
            pitch == -7 ? self.plotGreen() : self.plotRed()
            pitch == -8 ? self.plotGreen() : self.plotRed()
            pitch == -6 ? self.plotGreen() : self.plotRed()

            self.pitchIndicatorLine.transform = CGAffineTransform(translationX: 0, y: currentDistance)
            print(pitch)
        }
    }

I'm getting results from the above code for pitchIndicatorLine but the screen is facing in the upward direction (horizontally) and not facing myself (vertically), can anyone please correct the code for the device to work vertically.
Note: I think its more of a logic issue.


问:
Ruby on Rails: How to make a Navigation button to Older Articles
I'm working on a ruby on rails article page, I want to display four articles on front page as seen in my html/css/bulma code below, my question is how do I make users navigate to older articles with the post Navigation class code (1,2,3,4,5) beneath the articles, Thanks.</p>
```<code><section class="section blog-wrap">
<div class="container">
  <div class="columns is-multiline">
    <% @articles.each do |article| %>
      <div class="column is-6-desktop is-6-tablet">

      <div class="blog-item has-text-centered mb-3">

<%= image_tag("https://source.unsplash.com/random/1100x500", :alt => "rss feed", :class => "mb-4 rounded") %>

         <h3 class="mb-2"> <%= link_to article.title.capitalize, article%></h3>
         <div class="blog-item-meta ">
            <span class="is-uppercase text-sm mr-3 letter-spacing">by themefisher</span>
            <span class="is-uppercase text-sm letter-spacing"><i class="ti-time mr-1"></i> January 28,2019</span>
         </div>

         <p class="mt-3 mb-4"><%= render article %></p>
         <%= link_to 'Read More', article, class: "btn btn-main" %>

        </div>

   </div>
    <% end %>

</div>

<div class="columns mt-5 is-justify-content-center">
      <div class="column is-8-widescreen has-text-centered">
       <nav class="post-navigation">
                    <a class="current" href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                    <a href="#">4</a>
                    <a href="#">5</a>
                    <a href="#"><i class="ti-angle-right"></i></a>
               </nav>
            </div>
        </div>

    </div>

</section>

 ![](https://i.stack.imgur.com/161M5.jpg)

</code>```

Body:
I'm working on a ruby on rails article page, I want to display four articles on front page as seen in my html/css/bulma code below, my question is how do I make users navigate to older articles with the post Navigation class code (1,2,3,4,5) beneath the articles, Thanks.

    <% @articles.each do |article| %>

<%= image_tag("https://source.unsplash.com/random/1100x500", :alt => "rss feed", :class => "mb-4 rounded") %>

 <%= link_to article.title.capitalize, article%>

            by themefisher
             January 28,2019

<%= render article %>

         <%= link_to 'Read More', article, class: "btn btn-main" %>

    <% end %>

                    1
                    2
                    3
                    4
                    5

 ![](https://i.stack.imgur.com/161M5.jpg)


问:
How to dockerize vue3 laravel9 application?
I am developping a vue3 laravel9 SPA.
The app is presently running in dev and in production on a web hosting.

I would like to distribute it without the need of a web hosting as a dockerized application but I do not know docker that much.

I base my approach on this example : https://github.com/AveryHowell/docker-laravel-vue
I just copied from the example to my app

laravel/nginx (folder)
laravel/docker-compose.yml (file)
laravel/laravel.dockerfile (file)

vue/nginx.conf (file)
vue/vue.dockerfile (file)

The changes I made to this example are very limited.

First I changed the version of mysql in laravel/docker-compose.yml to mariadb:10.3.37

```<code>#Mysql DB
  mysql:
    image: mariadb:10.3.37
    container_name: db
    restart: unless-stopped
    tty: true
    ports:
        - "33061:3306"
    environment:
        MYSQL_ROOT_PASSWORD: secret
        MYSQL_DATABASE: laravel
    volumes:
      - ../mysql:/mysql
    networks:
      - app-network

</code>```

This version is the one I presently use and avoid some trouble with default values in json columns.

Secondly I changed the database config and some urls in .env

```<code>APP_NAME='my application'
APP_ENV=local
APP_KEY=base64:Wh2GGnDZ6YLEjNghheIX4qL+6P9lHuS8sO03L/pCufA=
APP_DEBUG=true
APP_URL=http://localhost
APP_API_URL=http://localhost/api/
APP_API_DEV_URL=http://localhost:8080/

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=secret
DB_ROOT_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=cookie
SESSION_LIFETIME=120
SESSION_DOMAIN=.localhost
SANCTUM_STATEFUL_DOMAINS=localhost:8080
SPA_URL=http://localhost:8080
</code>```

After that I used these commands

```<code> docker-compose up -d
 docker-compose exec laravel composer update
 docker-compose exec laravel composer install
 docker-compose exec laravel composer dump-autoload

 docker-compose exec laravel php artisan key:generate
 docker-compose exec laravel php artisan config:cache

 docker-compose exec laravel php artisan migrate:fresh
</code>```

I had the tables created in mariadb

but when I visited localhost:8080 as said in the example, I got this message

The connection was reset

The connection to the server was reset while the page was loading.

```<code>The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the web.
</code>```

What is wrong?

EDIT AFTER FIRST COMMENT

```<code>[jaaf@localhost laravel]$ docker container ls --filter label=com.docker.compose.project
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS                          PORTS                                         NAMES
5719d4b36179   laravel-webserver   "/docker-entrypoint.…"   44 minutes ago   Up 44 minutes                   0.0.0.0:80->80/tcp, :::80->80/tcp             webserver
9b88d442636c   laravel-vue         "docker-entrypoint.s…"   44 minutes ago   Restarting (1) 51 seconds ago                                                 vue
37743ac9307f   laravel             "docker-php-entrypoi…"   44 minutes ago   Up 44 minutes                   9000/tcp                                      laravel
1cf764c56ad0   mariadb:10.3.37     "docker-entrypoint.s…"   44 minutes ago   Up 44 minutes                   0.0.0.0:33061->3306/tcp, :::33061->3306/tcp   db
[jaaf@localhost laravel]$
</code>```

Body:
I am developping a vue3 laravel9 SPA.
The app is presently running in dev and in production on a web hosting.

I would like to distribute it without the need of a web hosting as a dockerized application but I do not know docker that much.

I base my approach on this example : https://github.com/AveryHowell/docker-laravel-vue
I just copied from the example to my app

laravel/nginx (folder)
laravel/docker-compose.yml (file)
laravel/laravel.dockerfile (file)

vue/nginx.conf (file)
vue/vue.dockerfile (file)

The changes I made to this example are very limited.

First I changed the version of mysql in laravel/docker-compose.yml to mariadb:10.3.37

#Mysql DB
  mysql:
    image: mariadb:10.3.37
    container_name: db
    restart: unless-stopped
    tty: true
    ports:
        - "33061:3306"
    environment:
        MYSQL_ROOT_PASSWORD: secret
        MYSQL_DATABASE: laravel
    volumes:
      - ../mysql:/mysql
    networks:
      - app-network

This version is the one I presently use and avoid some trouble with default values in json columns.

Secondly I changed the database config and some urls in .env

APP_NAME='my application'
APP_ENV=local
APP_KEY=base64:Wh2GGnDZ6YLEjNghheIX4qL+6P9lHuS8sO03L/pCufA=
APP_DEBUG=true
APP_URL=http://localhost
APP_API_URL=http://localhost/api/
APP_API_DEV_URL=http://localhost:8080/

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=secret
DB_ROOT_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=cookie
SESSION_LIFETIME=120
SESSION_DOMAIN=.localhost
SANCTUM_STATEFUL_DOMAINS=localhost:8080
SPA_URL=http://localhost:8080

After that I used these commands

 docker-compose up -d
 docker-compose exec laravel composer update
 docker-compose exec laravel composer install
 docker-compose exec laravel composer dump-autoload

 docker-compose exec laravel php artisan key:generate
 docker-compose exec laravel php artisan config:cache

 docker-compose exec laravel php artisan migrate:fresh

I had the tables created in mariadb

but when I visited localhost:8080 as said in the example, I got this message

The connection was reset

The connection to the server was reset while the page was loading.

The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the web.

What is wrong?

EDIT AFTER FIRST COMMENT

[jaaf@localhost laravel]$ docker container ls --filter label=com.docker.compose.project
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS                          PORTS                                         NAMES
5719d4b36179   laravel-webserver   "/docker-entrypoint.…"   44 minutes ago   Up 44 minutes                   0.0.0.0:80->80/tcp, :::80->80/tcp             webserver
9b88d442636c   laravel-vue         "docker-entrypoint.s…"   44 minutes ago   Restarting (1) 51 seconds ago                                                 vue
37743ac9307f   laravel             "docker-php-entrypoi…"   44 minutes ago   Up 44 minutes                   9000/tcp                                      laravel
1cf764c56ad0   mariadb:10.3.37     "docker-entrypoint.s…"   44 minutes ago   Up 44 minutes                   0.0.0.0:33061->3306/tcp, :::33061->3306/tcp   db
[jaaf@localhost laravel]$


问:
How to remove Request_install_package permission from flutter app?
I want to publish my android app written in flutter. Play Console have rejected my request. The problem is request_install_package permission. So i want to delete it but in release report i saw that many of my packages uses this permission. How to solve this problem?

I try to delete all my packages which use this permission, but actualy i cant run my application without this packages. I also try to remove permission from androidmanifest but it doesnt work.


问:
Bootstrap 5 popover with HTML content as data attribute
I want to show a Bootstrap 5 popover with custom HTML content. That means using the content option, and I can do that successfully the normal way (using javascript).

But I want to specify it in markup instead, as data-bs-content, without javascript. I tried this:

 document.getElementById('foo').innerHTML"
   >Show popover

  ...popover's content...

```

But the popover shows the literal text () => document.getElementById('foo').innerHTML.

Is my syntax incorrect, or is this impossible?

Body:
I want to show a Bootstrap 5 popover with custom HTML content. That means using the content option, and I can do that successfully the normal way (using javascript).

But I want to specify it in markup instead, as data-bs-content, without javascript. I tried this:

 document.getElementById('foo').innerHTML"
   >Show popover

  ...popover's content...

But the popover shows the literal text () => document.getElementById('foo').innerHTML.

Is my syntax incorrect, or is this impossible?


问:
Flutter ios libCachedImage not showing
Image stored in local libcachedimage not showing on real iOS device, below is the path where image is stored.

/Users/user***/Library/Developer/CoreSimulator/Devices/B8056AB3-B020-4520-A44E-B3C6E1F4B239/data/Containers/Data/Application/4FCE98E8-BD21-4A35-A79E-0B08EE931BCC/Library/Caches/libCachedImageData/5fa3e7e0-77fa-11ed-a821-d7297da5f84d.jpg'

But it's working with iOS emulator not on real device.

Thanks.

Title: Flutter ios libCachedImage not showing


问:
Direct to agent routing from standard Einstein bot in Salesforce
We have a requirement to directly route the chat from Einstein bot to a specific agent linked with the Case when the user clicks on Transfer menu and Einstein bot only supports bot/queue/skill transfer. We have tried a lot of things, including Apex class call to create/update PSR and Agentwork records but nothing seems to work. Has anybody done this? Any ideas would be much appreciated, Thanks

Called an Apex class to intercept the transfer by the bot and created/updated PSR and Agentwork records in that class to route to a specified PreferredUserId


问:
how to show the coordinates of each minimum moves the knight took to reach the target?
the code so far only displays an integer of the minimum steps the knight took to reach the target but how can i display that and all the moves coordinates that it took to reach said target position whilst avoiding the trap coordinates and still finding the shortest path?

i've tried different ways to code the trap location in but i keep getting errors so id really appreciate help

thank you!

```<code>class cell:

    def __init__(self, x=0, y=0, dist=0):
        self.x = x
        self.y = y
        self.dist = dist

# checks whether given position is
# inside the board

def isInside(x, y, N):
    if (x >= 1 and x <= N and
            y >= 1 and y <= N):
        return True
    return False

# Method returns minimum step to reach
# target position

def minStepToReachTarget(knightpos, targetpos, N):

    # all possible movements for the knight
    dx = [2, 2, -2, -2, 1, 1, -1, -1]
    dy = [1, -1, 1, -1, 2, -2, 2, -2]

    queue = []

    # push starting position of knight
    # with 0 distance
    queue.append(cell(knightpos[0], knightpos[1], 0))

    # make all cell unvisited
    visited = [[False for i in range(N + 1)]
               for j in range(N + 1)]

    # visit starting state
    visited[knightpos[0]][knightpos[1]] = True

    # loop until we have one element in queue
    while(len(queue) > 0):

        t = queue[0]
        queue.pop(0)

        # if current cell is equal to target
        # cell, return its distance
        if(t.x == targetpos[0] and
           t.y == targetpos[1]):
            return t.dist

        # iterate for all reachable states
        for i in range(8):

            x = t.x + dx[i]
            y = t.y + dy[i]

            if(isInside(x, y, N) and not visited[x][y]):
                visited[x][y] = True
                queue.append(cell(x, y, t.dist + 1))

# Driver Code
if __name__ == '__main__':
    N = int(input("input integer n (n≥8): "))

    while N<8:
        N = int(input("input out of range, please input again: "))

    #line2
    a, b = input("input starting location a, b : ").split()
    a= int(a)
    b= int(b)
    while (1>a or a>N) or (1>b or b>N):
        a, b = input("input out of range, please input again: ").split()
        a= int(a)
        b= int(b)
    while (1>a or a>N) or (1>b or b>N):
        a, b = input("input out of range, please input again: ").split()
        a= int(a)
        b= int(b)

    knightpos = [a, b]

    c, d = input("input ending location c, d : ").split()
    c= int(c)
    d= int(d)
    while (1>c or c>N) or (1>d or d>N):
        c, d = input("input out of range, please input again: ").split()
        c= int(c)
        d= int(d)
    targetpos = [c, d]

    m = int(input("input integer m: "))
    if m==0:
        pass
    else:

        trapLocation = []
        trap_length = m

        for idx in range(trap_length):
            x = int(input("input trap location x coordinate: "))
            y = int(input("input trap location y coordinate: "))
            trapLocation.append((x, y))

    startPoint = (a,b)
    if startPoint in trapLocation:
        print("No")
        pass
    else:
        print("Yes")
        print(minStepToReachTarget(knightpos, targetpos, N))
</code>```

Body:
the code so far only displays an integer of the minimum steps the knight took to reach the target but how can i display that and all the moves coordinates that it took to reach said target position whilst avoiding the trap coordinates and still finding the shortest path?

i've tried different ways to code the trap location in but i keep getting errors so id really appreciate help

thank you!

class cell:

    def __init__(self, x=0, y=0, dist=0):
        self.x = x
        self.y = y
        self.dist = dist

# checks whether given position is
# inside the board

def isInside(x, y, N):
    if (x >= 1 and x <= N and
            y >= 1 and y <= N):
        return True
    return False

# Method returns minimum step to reach
# target position

def minStepToReachTarget(knightpos, targetpos, N):

    # all possible movements for the knight
    dx = [2, 2, -2, -2, 1, 1, -1, -1]
    dy = [1, -1, 1, -1, 2, -2, 2, -2]

    queue = []

    # push starting position of knight
    # with 0 distance
    queue.append(cell(knightpos[0], knightpos[1], 0))

    # make all cell unvisited
    visited = [[False for i in range(N + 1)]
               for j in range(N + 1)]

    # visit starting state
    visited[knightpos[0]][knightpos[1]] = True

    # loop until we have one element in queue
    while(len(queue) > 0):

        t = queue[0]
        queue.pop(0)

        # if current cell is equal to target
        # cell, return its distance
        if(t.x == targetpos[0] and
           t.y == targetpos[1]):
            return t.dist

        # iterate for all reachable states
        for i in range(8):

            x = t.x + dx[i]
            y = t.y + dy[i]

            if(isInside(x, y, N) and not visited[x][y]):
                visited[x][y] = True
                queue.append(cell(x, y, t.dist + 1))

# Driver Code
if __name__ == '__main__':
    N = int(input("input integer n (n≥8): "))

    while N<8:
        N = int(input("input out of range, please input again: "))

    #line2
    a, b = input("input starting location a, b : ").split()
    a= int(a)
    b= int(b)
    while (1>a or a>N) or (1>b or b>N):
        a, b = input("input out of range, please input again: ").split()
        a= int(a)
        b= int(b)
    while (1>a or a>N) or (1>b or b>N):
        a, b = input("input out of range, please input again: ").split()
        a= int(a)
        b= int(b)

    knightpos = [a, b]

    c, d = input("input ending location c, d : ").split()
    c= int(c)
    d= int(d)
    while (1>c or c>N) or (1>d or d>N):
        c, d = input("input out of range, please input again: ").split()
        c= int(c)
        d= int(d)
    targetpos = [c, d]

    m = int(input("input integer m: "))
    if m==0:
        pass
    else:

        trapLocation = []
        trap_length = m

        for idx in range(trap_length):
            x = int(input("input trap location x coordinate: "))
            y = int(input("input trap location y coordinate: "))
            trapLocation.append((x, y))

    startPoint = (a,b)
    if startPoint in trapLocation:
        print("No")
        pass
    else:
        print("Yes")
        print(minStepToReachTarget(knightpos, targetpos, N))


问:
How can I create general " updateState " function which updates the function according to the value, and state name passed from action payload in ts?
I'm trying to create a general update state function in reducer, using redux toolkit and typescript. I'm getting this error "Type 'any' is not assignable to type 'never'". I have declared the type for my stateName property ('name'| 'isOpen') , but it says its type is 'never. Here is my code.

```<code>import { createSlice, PayloadAction } from "@reduxjs/toolkit";

type InitialState = {
  isOpen: boolean;
  name: string;
};

type UpdateStatePayload = {
  stateName: "name" | "isOpen";
  value: any;
};

const initialState: InitialState = {
  isOpen: false,
  name: "Mirfayz Karimov",
};

export const appSlice = createSlice({
  name: "appReducer",
  initialState,
  reducers: {
    updateState: (state, action: PayloadAction<UpdateStatePayload>) => {
      state[action.payload.stateName] = action.payload.value;
    },
  },
});

</code>```

I have changed the type of stateName to string, but still it doesn't work.

```<code>type UpdateStatePayload = {
  stateName: string;
  value: any;
};
</code>```

Body:
I'm trying to create a general update state function in reducer, using redux toolkit and typescript. I'm getting this error "Type 'any' is not assignable to type 'never'". I have declared the type for my stateName property ('name'| 'isOpen') , but it says its type is 'never. Here is my code.

import { createSlice, PayloadAction } from "@reduxjs/toolkit";

type InitialState = {
  isOpen: boolean;
  name: string;
};

type UpdateStatePayload = {
  stateName: "name" | "isOpen";
  value: any;
};

const initialState: InitialState = {
  isOpen: false,
  name: "Mirfayz Karimov",
};

export const appSlice = createSlice({
  name: "appReducer",
  initialState,
  reducers: {
    updateState: (state, action: PayloadAction<UpdateStatePayload>) => {
      state[action.payload.stateName] = action.payload.value;
    },
  },
});

I have changed the type of stateName to string, but still it doesn't work.

type UpdateStatePayload = {
  stateName: string;
  value: any;
};


问:
How to use recurse method in cypress
*I tried this code first time its working fine the second time it failed got error.
cy.eq() failed because this element is detached from the DOM.

...
Cypress requires elements be attached in the DOM to interact with them.
The previous command that ran was:
> cy.get()
This DOM element likely became detached somewhere between the previous and current command.
Common situations why this happens:
- Your JS framework re-rendered asynchronously
- Your app code reacted to an event firing and removed the element
You typically need to re-query for the element or add 'guards' which delay Cypress from running new commands.
All 2 subject validations failed on this subject.*

code:

```<code>recurse(
          () => cy.get('selectorA').should(Cypress._.noop),
          ($button) => $button.length === 0,
          {
            post() {
              cy.get('selectorA').eq(0).trigger('mouseover', { bubbles: false });
              cy.get('selectorB').eq(0).click({ force: true }).wait(1000);
            },
            delay:1000,
            limit:10,
            timeout:15000
          }
        )
</code>```

Title: How to use recurse method in cypress

Body:
*I tried this code first time its working fine the second time it failed got error.
cy.eq() failed because this element is detached from the DOM.

...
Cypress requires elements be attached in the DOM to interact with them.
The previous command that ran was:
> cy.get()
This DOM element likely became detached somewhere between the previous and current command.
Common situations why this happens:
- Your JS framework re-rendered asynchronously
- Your app code reacted to an event firing and removed the element
You typically need to re-query for the element or add 'guards' which delay Cypress from running new commands.
All 2 subject validations failed on this subject.*

code:

recurse(
          () => cy.get('selectorA').should(Cypress._.noop),
          ($button) => $button.length === 0,
          {
            post() {
              cy.get('selectorA').eq(0).trigger('mouseover', { bubbles: false });
              cy.get('selectorB').eq(0).click({ force: true }).wait(1000);
            },
            delay:1000,
            limit:10,
            timeout:15000
          }
        )


问:
Script 'C:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159 flutter
Since yesterday, when I try to run my Flutter project, I encounter the following error. But when I don't use Hive and Hive_Flutter package, this error is solved. Thank you for helping me.

Script 'C:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159

What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\Flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 12s
Exception: Gradle task assembleDebug failed with exit code 1


问:
how to redirect to a url with dynamic parameter with declarativeNetRequest rule in chrome exension?
I have a chrome extension redirecting webpages on specific website(like example.com) containing certain string(like docs) in url to my page using declarativeNetRequest. I want to show url of blocked page in my extension page, thus I need to somehow pass url of blocked page to my page. So the requirement is to redirect something like http://www.example.com/support/docs/index.html to https://example2.com?url=http://www.example.com/support/docs/index.html. I tried to use redirect.regexSubstution and redirect.transform, but couldn't make it. How can I achieve it?
here is an example showing what I want to do</p>
```<code> {
    "id": 4,
    "priority": 1,
    "action": { "type": "redirect", "redirect": { "url": "https://example2.com?url=xxxx" } },
    "condition": { "regexFilter": "docs",
                   "requestDomains": ["example.com"],
                   "resourceTypes": ["main_frame"] }
  }
</code>```

Body:
I have a chrome extension redirecting webpages on specific website(like example.com) containing certain string(like docs) in url to my page using declarativeNetRequest. I want to show url of blocked page in my extension page, thus I need to somehow pass url of blocked page to my page. So the requirement is to redirect something like http://www.example.com/support/docs/index.html to https://example2.com?url=http://www.example.com/support/docs/index.html. I tried to use redirect.regexSubstution and redirect.transform, but couldn't make it. How can I achieve it?
here is an example showing what I want to do

 {
    "id": 4,
    "priority": 1,
    "action": { "type": "redirect", "redirect": { "url": "https://example2.com?url=xxxx" } },
    "condition": { "regexFilter": "docs",
                   "requestDomains": ["example.com"],
                   "resourceTypes": ["main_frame"] }
  }


问:
formatting a table using KableExtra
trying to create a table with a set of data from an excel sheet. the table comes out fine, however i keep seeing a replication of the column name. especially when numerical data is used. for example it continues to repeat station 1 as station 1....2 and station 2 as station 2...3 as below
this is what the output looked like

here is the code i ran

```<code>```{r echo=FALSE}
library(kableExtra)
library(readxl)
options(knitr.kable.NA = '')
LAGOS_SHIP_CHANNEL <- read_excel("C:/Users/missw/Desktop/903 -/LAGOS SHIP CHANNEL.xlsx",
    sheet = "dry _wet seasn")
dt <- LAGOS_SHIP_CHANNEL
kbl(dt, caption = "Monthly composition of zooplankton per ml at Lagos Ship Channel, Southwest Nigeria (Nov. 2021- Aug. 2022)", booktabs = T) %>%
row_spec(row = 1:13, italic = TRUE) %>%
row_spec(18:19, bold = T)  %>%
kable_styling(latex_options = c("HOLD_position")) %>%
kable_classic() %>%
add_header_above(c(" " = 1,"Dry season" = 7, "Wet season" = 7))
```
</code>```

this was the result.

```<code>> library(kableExtra)
> library(readxl)
> options(knitr.kable.NA = '')
> LAGOS_SHIP_CHANNEL <- read_excel("C:/Users/missw/Desktop/903 -/LAGOS SHIP CHANNEL.xlsx",
+     sheet = "dry _wet seasn")
New names:
> dt <- LAGOS_SHIP_CHANNEL
> kbl(dt, caption = "Monthly composition of zooplankton per ml at Lagos Ship Channel, Southwest Nigeria (Nov. 2021- Aug. 2022)", booktabs = T) %>%
+ row_spec(row = 1:13, italic = TRUE) %>%
+ row_spec(18:19, bold = T)  %>%
+ kable_styling(latex_options = c("HOLD_position")) %>%
+ kable_classic() %>%
+ add_header_above(c(" " = 1,"Dry season" = 7, "Wet season" = 7))
</code>```

my problem is when i knit to pdf, "new names" is also displayed in the pdf. the output shows a repition of the column values -

what i expect as output was

station 1 , station 2, station 3, station 4

Title: formatting a table using KableExtra

Body:
trying to create a table with a set of data from an excel sheet. the table comes out fine, however i keep seeing a replication of the column name. especially when numerical data is used. for example it continues to repeat station 1 as station 1....2 and station 2 as station 2...3 as below
this is what the output looked like

here is the code i ran

```{r echo=FALSE}
library(kableExtra)
library(readxl)
options(knitr.kable.NA = '')
LAGOS_SHIP_CHANNEL <- read_excel("C:/Users/missw/Desktop/903 -/LAGOS SHIP CHANNEL.xlsx",
    sheet = "dry _wet seasn")
dt <- LAGOS_SHIP_CHANNEL
kbl(dt, caption = "Monthly composition of zooplankton per ml at Lagos Ship Channel, Southwest Nigeria (Nov. 2021- Aug. 2022)", booktabs = T) %>%
row_spec(row = 1:13, italic = TRUE) %>%
row_spec(18:19, bold = T)  %>%
kable_styling(latex_options = c("HOLD_position")) %>%
kable_classic() %>%
add_header_above(c(" " = 1,"Dry season" = 7, "Wet season" = 7))
```

this was the result.

> library(kableExtra)
> library(readxl)
> options(knitr.kable.NA = '')
> LAGOS_SHIP_CHANNEL <- read_excel("C:/Users/missw/Desktop/903 -/LAGOS SHIP CHANNEL.xlsx",
+     sheet = "dry _wet seasn")
New names:
> dt <- LAGOS_SHIP_CHANNEL
> kbl(dt, caption = "Monthly composition of zooplankton per ml at Lagos Ship Channel, Southwest Nigeria (Nov. 2021- Aug. 2022)", booktabs = T) %>%
+ row_spec(row = 1:13, italic = TRUE) %>%
+ row_spec(18:19, bold = T)  %>%
+ kable_styling(latex_options = c("HOLD_position")) %>%
+ kable_classic() %>%
+ add_header_above(c(" " = 1,"Dry season" = 7, "Wet season" = 7))

my problem is when i knit to pdf, "new names" is also displayed in the pdf. the output shows a repition of the column values -

what i expect as output was

station 1 , station 2, station 3, station 4


问:
Dataproc PHS Yarn RM UI not able to read logs from remote-app-log-dir
I am working on setting up a dataproc PHS for my Spark and Hive applications. I was successfully able to set up the Spark History Server in a standalone dataproc cluster (PHS) by setting up the following configs:

```<code>'spark:spark.history.fs.logDirectory': 'gs://my-bkt/phs/logs/*/spark-job-history'
'spark:spark.eventLog.dir': 'gs://my-bkt/phs/logs/*/spark-job-history'
</code>```

This worked fine and the Spark History Server was able to read logs from eventLog dir.

I have also configured to read the job related YARN logs as well for PHS. Using the following configs:

```<code>'dataproc:yarn.log-aggregation.enabled': 'true',
'yarn:yarn.nodemanager.remote-app-log-dir': 'gs://my-bkt/phs/logs/*/yarn-logs',
'yarn:yarn.log-aggregation.retain-seconds': '-1',
'yarn:yarn.log.server.url': 'http://dataproc-phs-cluster-m:19888/jobhistory/logs',
'spark:spark.yarn.historyServer.address': 'dataproc-phs-cluster-m:18080'
</code>```

Note: dataproc-phs-cluster is the cluster name.

The jobs were able to write the aggregated YARN logs in the following directory: gs://my-bkt/phs/logs/<JOB_CLUSTER_NAME>/yarn-logs//logs/<APP_ID>, and I am able to open and view the aggregated logs as well.

But these logs are not viewed in the PHS YARN UI. Any suggestion how to achieve it?

Body:
I am working on setting up a dataproc PHS for my Spark and Hive applications. I was successfully able to set up the Spark History Server in a standalone dataproc cluster (PHS) by setting up the following configs:

'spark:spark.history.fs.logDirectory': 'gs://my-bkt/phs/logs/*/spark-job-history'
'spark:spark.eventLog.dir': 'gs://my-bkt/phs/logs/*/spark-job-history'

This worked fine and the Spark History Server was able to read logs from eventLog dir.

I have also configured to read the job related YARN logs as well for PHS. Using the following configs:

'dataproc:yarn.log-aggregation.enabled': 'true',
'yarn:yarn.nodemanager.remote-app-log-dir': 'gs://my-bkt/phs/logs/*/yarn-logs',
'yarn:yarn.log-aggregation.retain-seconds': '-1',
'yarn:yarn.log.server.url': 'http://dataproc-phs-cluster-m:19888/jobhistory/logs',
'spark:spark.yarn.historyServer.address': 'dataproc-phs-cluster-m:18080'

Note: dataproc-phs-cluster is the cluster name.

The jobs were able to write the aggregated YARN logs in the following directory: gs://my-bkt/phs/logs/<JOB_CLUSTER_NAME>/yarn-logs//logs/<APP_ID>, and I am able to open and view the aggregated logs as well.

But these logs are not viewed in the PHS YARN UI. Any suggestion how to achieve it?


问:
Keycloak Sign in with Google using custom Login page
I am trying to move my in-house user management to Keycloak.

My website is hosted on example.com and Keycloak is hosted on a sub-domain keycloak.example.com.

As of now, I am using Nodejs passport library for Google Sign-In.

So far I am unable to find out any resource on how to do this. I don't want to use the Keycloak login page. In fact, I want to keep Keycloak private and not accessible to the public.

All communication with Keycloak should be internal.

Tech Stack: NodeJS and ReactJS. Passport lib.

For user signup using a password, I am using Keycloak REST API.

Thank you


问:
Is there any way to get complete user data from Facebook using webhooks?
I am trying to create an application in which I would like to display feeds from multiple social media apps including Facebook ,Instagram ,Twitter. I would like to get the data live as much as possible so I thought of integrating Facebook's webhook in my project. I created a server side application with Facebook's authentication and I created a callback URL and configured it to webhooks in my meta developers app. I was able to get a json object every time a change happens in my feed. But I couldn't get the exact details about the change.

Every time if someone likes or comments on my Facebook profile I get a json object like this:

```<code>{
    "entry": [
      {
        "id": "10603189900****",
        "time": 1670853367,
        "uid": "10603189900****",
        "changes": [
          {
            "field": "feed"
          }
        ]
      }
    ],
    "object": "user"
}
</code>```

But it doesn't give any data that explains what the actual event occurred is. For instance, if someone commented on my posts I want to get the details on the post in which the event happened, the details about the person who commented it and also the whole texts of the comments.

I would like to know if there is any possibilities to get the whole data?

Body:
I am trying to create an application in which I would like to display feeds from multiple social media apps including Facebook ,Instagram ,Twitter. I would like to get the data live as much as possible so I thought of integrating Facebook's webhook in my project. I created a server side application with Facebook's authentication and I created a callback URL and configured it to webhooks in my meta developers app. I was able to get a json object every time a change happens in my feed. But I couldn't get the exact details about the change.

Every time if someone likes or comments on my Facebook profile I get a json object like this:

{
    "entry": [
      {
        "id": "10603189900****",
        "time": 1670853367,
        "uid": "10603189900****",
        "changes": [
          {
            "field": "feed"
          }
        ]
      }
    ],
    "object": "user"
}

But it doesn't give any data that explains what the actual event occurred is. For instance, if someone commented on my posts I want to get the details on the post in which the event happened, the details about the person who commented it and also the whole texts of the comments.

I would like to know if there is any possibilities to get the whole data?


问:
if exists then don't insert else insert in postgresql
The candidate should not be allowed to enroll for a course already enrolled (Show error message "Already enrolled!").

try:

```<code>create or replace procedure cour_check(registration_id character varying(10),
                            course_cd numeric(5))
language plpgsql as
$$
begin

if exists (select registration_id,course_cd from course_registration
           where registration_id = registration_id and course_cd = course_cd)
           then return 0;

else

insert into course_registration(registration_id,course_cd,course_regn_dt)
values (registration_id,course_cd,GETDATE())

end
$$;
</code>```

expecting:

The candidate should not be allowed to enroll for a course already enrolled (Show error message "Already enrolled!").

Body:
The candidate should not be allowed to enroll for a course already enrolled (Show error message "Already enrolled!").

try:

create or replace procedure cour_check(registration_id character varying(10),
                            course_cd numeric(5))
language plpgsql as
$$
begin

if exists (select registration_id,course_cd from course_registration
           where registration_id = registration_id and course_cd = course_cd)
           then return 0;

else

insert into course_registration(registration_id,course_cd,course_regn_dt)
values (registration_id,course_cd,GETDATE())

end
$$;

expecting:

The candidate should not be allowed to enroll for a course already enrolled (Show error message "Already enrolled!").


问:
How to update WebView height when changing text size?
i am very new to Swift and Xcode and i am making app from my WordPress Website , all works fine , but i have added two buttons for zoom text in WebView, one for zoom in and one for zoom out,, now when i zoom in the text then webView's height is also getting updated but when i zoom out then webView's height is not getting updated. and i see blank space between webView and next view which is adMob ads.. this is my code

```<code> @objc func tapplusButton() {
    clickCount+=1
    fontSize = fontSize + 20
    let textSize = fontSize
        let javascript = "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '\(textSize)%'"
        webView.evaluateJavaScript(javascript) { (response, error) in
            print()
        }

    DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
         self.webView.evaluateJavaScript("document.readyState", completionHandler: { (complete, error) in
             if complete != nil {
                 self.webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { [self] (height, error) in
                    self.heightWeb.constant = webView.scrollView.contentSize.height

                 })
             }
         })

     }

    }
</code>```

and for zoom out this is what i am trying , it works but webView's height not getting updated..

```<code> @objc func tapminusButton() {

    clickCount+=1
    fontSize = fontSize - 20

    let textSize = fontSize
        let javascript = "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '\(textSize)%'"
        webView.evaluateJavaScript(javascript) { (response, error) in
            print()
        }

    DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
         self.webView.evaluateJavaScript("document.readyState", completionHandler: { (complete, error) in
             if complete != nil {
                 self.webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { [self] (height, error) in
                    self.heightWeb.constant = webView.scrollView.contentSize.height

                 })
             }
         })

     }

    }
</code>```

can anyine please help ?

Body:
i am very new to Swift and Xcode and i am making app from my WordPress Website , all works fine , but i have added two buttons for zoom text in WebView, one for zoom in and one for zoom out,, now when i zoom in the text then webView's height is also getting updated but when i zoom out then webView's height is not getting updated. and i see blank space between webView and next view which is adMob ads.. this is my code

 @objc func tapplusButton() {
    clickCount+=1
    fontSize = fontSize + 20
    let textSize = fontSize
        let javascript = "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '\(textSize)%'"
        webView.evaluateJavaScript(javascript) { (response, error) in
            print()
        }

    DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
         self.webView.evaluateJavaScript("document.readyState", completionHandler: { (complete, error) in
             if complete != nil {
                 self.webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { [self] (height, error) in
                    self.heightWeb.constant = webView.scrollView.contentSize.height

                 })
             }
         })

     }

    }

and for zoom out this is what i am trying , it works but webView's height not getting updated..

 @objc func tapminusButton() {

    clickCount+=1
    fontSize = fontSize - 20

    let textSize = fontSize
        let javascript = "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '\(textSize)%'"
        webView.evaluateJavaScript(javascript) { (response, error) in
            print()
        }

    DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
         self.webView.evaluateJavaScript("document.readyState", completionHandler: { (complete, error) in
             if complete != nil {
                 self.webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { [self] (height, error) in
                    self.heightWeb.constant = webView.scrollView.contentSize.height

                 })
             }
         })

     }

    }

can anyine please help ?


问:
reac.js using MUI and graphQl
enter image description herethis issue in google chrome, mobiles and if site lang is arabic
half data not shown . and when scroll or close mobile data be show

in arabic languge mui table did not show all data in chrome at mobile

Title: reac.js using MUI and graphQl


问:
Cannot run react file due to MUI Material problem and can't use npm to install package
I got these from Terminal when I tried to install and uninstall package by npm :

```<code>npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: <user>@1.0.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.6.3" from shards-react@1.0.3
npm ERR! node_modules/shards-react
npm ERR!   shards-react@"^1.0.3" from the root project
npm ERR!
</code>```

so i cannot use npm to install or uninstall any package which was downloaded now

and compiled problem was :

```<code>ERROR in ./node_modules/@mui/material/styles/index.js 2:0-191

export 'experimental_sx' (reexported as 'experimental_sx') was not found in '@mui/system' (possible exports: Box, Container, GlobalStyles, Stack, StyledEngineProvider, ThemeProvider, Unstable_Grid, alignContent, alignItems, alignSelf, alpha, backgroundColor, bgcolor, border, borderBottom, borderBottomColor, borderColor, borderLeft, borderLeftColor, borderRadius, borderRight, borderRightColor, borderTop, borderTopColor, borderTransform, borders, bottom, boxSizing, breakpoints, color, colorChannel, columnGap, compose, containerClasses, createBox, createBreakpoints, createContainer, createGrid, createSpacing, createStack, createStyled, createTheme, createUnarySpacing, createUnaryUnit, css, darken, decomposeColor, display, emphasize, flex, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, flexbox, fontFamily, fontSize, fontStyle, fontWeight, gap, getContainerUtilityClass, getContrastRatio, getGridUtilityClass, getLuminance, getPath, getStackUtilityClass, getStyleFromPropValue, getStyleValue, getThemeProps, getValue, grid, gridArea, gridAutoColumns, gridAutoFlow, gridAutoRows, gridClasses, gridColumn, gridRow, gridTemplateAreas, gridTemplateColumns, gridTemplateRows, handleBreakpoints, height, hexToRgb, hslToRgb, justifyContent, justifyItems, justifySelf, keyframes, left, letterSpacing, lighten, lineHeight, margin, marginKeys, maxHeight, maxWidth, mergeBreakpointsInOrder, minHeight, minWidth, order, padding, paddingKeys, palette, paletteTransform, position, positions, private_safeAlpha, private_safeColorChannel, private_safeDarken, private_safeEmphasize, private_safeLighten, recomposeColor, responsivePropType, rgbToHex, right, rowGap, shadows, shape, shouldForwardProp, sizeHeight, sizeWidth, sizing, sizingTransform, spacing, stackClasses, style, styled, systemDefaultTheme, textAlign, textTransform, top, typography, typographyVariant, unstable_createCssVarsProvider, unstable_createGetCssVar, unstable_createStyleFunctionSx, unstable_defaultSxConfig, unstable_extendSxProp, unstable_getThemeValue, unstable_resolveBreakpointValues, unstable_styleFunctionSx, useTheme, useThemeProps, useThemeWithoutDefault, width, zIndex)
</code>```

PS. I use @mui/material@5.11.0 and React18.2.0 now

I tried to compile an fix the problem by change the version of package by yarn and change the version in package.json file but it didn't work at all. So how can I fix this problem?

Thank you

Body:
I got these from Terminal when I tried to install and uninstall package by npm :

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: <user>@1.0.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.6.3" from shards-react@1.0.3
npm ERR! node_modules/shards-react
npm ERR!   shards-react@"^1.0.3" from the root project
npm ERR!

so i cannot use npm to install or uninstall any package which was downloaded now

and compiled problem was :

ERROR in ./node_modules/@mui/material/styles/index.js 2:0-191

export 'experimental_sx' (reexported as 'experimental_sx') was not found in '@mui/system' (possible exports: Box, Container, GlobalStyles, Stack, StyledEngineProvider, ThemeProvider, Unstable_Grid, alignContent, alignItems, alignSelf, alpha, backgroundColor, bgcolor, border, borderBottom, borderBottomColor, borderColor, borderLeft, borderLeftColor, borderRadius, borderRight, borderRightColor, borderTop, borderTopColor, borderTransform, borders, bottom, boxSizing, breakpoints, color, colorChannel, columnGap, compose, containerClasses, createBox, createBreakpoints, createContainer, createGrid, createSpacing, createStack, createStyled, createTheme, createUnarySpacing, createUnaryUnit, css, darken, decomposeColor, display, emphasize, flex, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, flexbox, fontFamily, fontSize, fontStyle, fontWeight, gap, getContainerUtilityClass, getContrastRatio, getGridUtilityClass, getLuminance, getPath, getStackUtilityClass, getStyleFromPropValue, getStyleValue, getThemeProps, getValue, grid, gridArea, gridAutoColumns, gridAutoFlow, gridAutoRows, gridClasses, gridColumn, gridRow, gridTemplateAreas, gridTemplateColumns, gridTemplateRows, handleBreakpoints, height, hexToRgb, hslToRgb, justifyContent, justifyItems, justifySelf, keyframes, left, letterSpacing, lighten, lineHeight, margin, marginKeys, maxHeight, maxWidth, mergeBreakpointsInOrder, minHeight, minWidth, order, padding, paddingKeys, palette, paletteTransform, position, positions, private_safeAlpha, private_safeColorChannel, private_safeDarken, private_safeEmphasize, private_safeLighten, recomposeColor, responsivePropType, rgbToHex, right, rowGap, shadows, shape, shouldForwardProp, sizeHeight, sizeWidth, sizing, sizingTransform, spacing, stackClasses, style, styled, systemDefaultTheme, textAlign, textTransform, top, typography, typographyVariant, unstable_createCssVarsProvider, unstable_createGetCssVar, unstable_createStyleFunctionSx, unstable_defaultSxConfig, unstable_extendSxProp, unstable_getThemeValue, unstable_resolveBreakpointValues, unstable_styleFunctionSx, useTheme, useThemeProps, useThemeWithoutDefault, width, zIndex)

PS. I use @mui/material@5.11.0 and React18.2.0 now

I tried to compile an fix the problem by change the version of package by yarn and change the version in package.json file but it didn't work at all. So how can I fix this problem?

Thank you


问:
Material Design horizontal dividers coming at the middle and end of grid layout inside recycler view
I am trying to add divider in between items of grid layout but the divider is coming in between and in the end of recycler view is there any way to remove the divider which is coming at the end of recycler view.

XML of Home Fragment

```<code><?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".home.HomeFragment">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <include
            android:id="@+id/home_actionbar"
            layout="@layout/actionbar"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"/>

        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/product_heading"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toBottomOf="@id/home_actionbar"
            app:layout_constraintStart_toStartOf="parent"
            android:layout_marginStart="15sp"
            android:text="@string/all_products_heading"
            android:layout_marginTop="15sp"
            android:textSize="24sp"
            android:fontFamily="@font/roboto_bold_italic"/>

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/productRV"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                android:scrollbars="vertical"
                app:layout_constraintTop_toBottomOf="@id/product_heading"
                tools:listitem="@layout/product_item"/>

    </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</code>```

Recycler view config

```<code>val recyclerView = view.findViewById<RecyclerView>(R.id.productRV)
val horizontalDivider = MaterialDividerItemDecoration(recyclerView.context,
    LinearLayoutManager.HORIZONTAL )
val verticalDivider = MaterialDividerItemDecoration(recyclerView.context,
    LinearLayoutManager.VERTICAL )

recyclerView.apply {
    addItemDecoration(horizontalDivider)
    addItemDecoration(verticalDivider)
    layoutManager = GridLayoutManager(view.context,2)
    adapter = recyclerAdapter
}
</code>```
```<code></code>```

Body:
I am trying to add divider in between items of grid layout but the divider is coming in between and in the end of recycler view is there any way to remove the divider which is coming at the end of recycler view.

XML of Home Fragment

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".home.HomeFragment">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <include
            android:id="@+id/home_actionbar"
            layout="@layout/actionbar"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"/>

        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/product_heading"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toBottomOf="@id/home_actionbar"
            app:layout_constraintStart_toStartOf="parent"
            android:layout_marginStart="15sp"
            android:text="@string/all_products_heading"
            android:layout_marginTop="15sp"
            android:textSize="24sp"
            android:fontFamily="@font/roboto_bold_italic"/>

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/productRV"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                android:scrollbars="vertical"
                app:layout_constraintTop_toBottomOf="@id/product_heading"
                tools:listitem="@layout/product_item"/>

    </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

Recycler view config

val recyclerView = view.findViewById<RecyclerView>(R.id.productRV)
val horizontalDivider = MaterialDividerItemDecoration(recyclerView.context,
    LinearLayoutManager.HORIZONTAL )
val verticalDivider = MaterialDividerItemDecoration(recyclerView.context,
    LinearLayoutManager.VERTICAL )

recyclerView.apply {
    addItemDecoration(horizontalDivider)
    addItemDecoration(verticalDivider)
    layoutManager = GridLayoutManager(view.context,2)
    adapter = recyclerAdapter
}


问:
How to create an object with a file attribute when testing a model?
I'm testing a model and I'm wondering when creating an object that requires a file how do I  do that? For the group object below, the name attribute is required so I passed 'Sports', for the icon how should I pass a file, or what's the correct way to test such?

group_spec.rb

```<code>require 'rails_helper'

RSpec.describe Group, type: :model do
  before :each do
    user = User.create(name: 'Test', email: 'test@gmail.com', password: '123456',
                       password_confirmation: '123456')
    @group = Group.create(name: 'Sports', icon: )
    @group.user = user
  end

  it 'is not valid without a name' do
    @group.name = nil
    expect(@group).to_not be_valid
  end

  it 'is not valid without an icon' do
    @group.icon = nil
    expect(@group).to_not be_valid
  end
end
</code>```

my model

```<code>class Group < ApplicationRecord
  belongs_to :user
  has_many :categorizations
  has_many :entities, through: :categorizations

  has_one_attached :icon do |attachable|
    attachable.variant :thumb, resize_to_limit: [100, 100]
  end

  #  validations
  validates :name, presence: true, length: { maximum: 40 }
  validates :icon, presence: true
end
</code>```

Body:
I'm testing a model and I'm wondering when creating an object that requires a file how do I  do that? For the group object below, the name attribute is required so I passed 'Sports', for the icon how should I pass a file, or what's the correct way to test such?

group_spec.rb

require 'rails_helper'

RSpec.describe Group, type: :model do
  before :each do
    user = User.create(name: 'Test', email: 'test@gmail.com', password: '123456',
                       password_confirmation: '123456')
    @group = Group.create(name: 'Sports', icon: )
    @group.user = user
  end

  it 'is not valid without a name' do
    @group.name = nil
    expect(@group).to_not be_valid
  end

  it 'is not valid without an icon' do
    @group.icon = nil
    expect(@group).to_not be_valid
  end
end

my model

class Group < ApplicationRecord
  belongs_to :user
  has_many :categorizations
  has_many :entities, through: :categorizations

  has_one_attached :icon do |attachable|
    attachable.variant :thumb, resize_to_limit: [100, 100]
  end

  #  validations
  validates :name, presence: true, length: { maximum: 40 }
  validates :icon, presence: true
end


问:
How Terraform output info from internal AWS ec2
I use Terraform to build AWS EC2 with Microk8s. I did it successfully.

But now I have a requirement that I want to use Terraform out the API Server of Microk8s.

I know how to find API server manually.
SSH AWS EC2
use command "sudo microk8s kubectl add-node"

But I have no idea about using  Terraform output the info above.
Could you please teach me the way ?

Thanks,
Ziv


问:
How to map external request IDs to Spark Job IDs for Spark instrumentation
We have deployed a system of Analytics APIs that internally uses PySpark to serve requests to our customers. Since, we expect a very high scale of incoming requests at any time, we are interested in instrumenting Spark, so as to understand the various bottlenecks with our implementation of it. We already have monitoring solutions in place that give us a break down of time-taken at component-level for each of our services. Diving deep on this we know that for the same API call, a number of times Spark arbitrarily takes a long time while at other times it returns early. This leads to random unexpected response times for our APIs.

Therefore, we have decided to learn more about the cause behind such spikes in time taken by Spark. Since, this is a production environment, we decided to implement Spark Listeners for instrumentation purposes. However, given that we have a number of different APIs that can be called in parallel, there is no way for us to confidently know which Spark Jobs are being spawned by which API call.

We tried retrieving more information through the history server but again there was no way to know which jobs related to which API call.

In a nutshell, we are looking for any way to know which set of Spark jobs are being called by any of our APIs. We have unique requestIds for our APIs and would want to maintain a one-to-many relationship between the two.


问:
how to open all documents in flutter after getting path in Flutter
I get different documents in different screens. now I want to read these files. Is there any package that can read all files like docx,pptx, pdf and so on through a single package? I used pdf viewer package to read pdf files. but like this, i have to use different packages to read the different files. is there any single package that can read all of my files</p>


问:
posthog - drop events that contain specific params (not values)
im trying to drop events in posthog that contain the query params "username" / "password" in the "current url" / "referrer url" fields. it doesnt matter what values they have .

tried to use:
Filter Out Plugin - but it just blocks everything once i put it
Drop Events Based On Property - didnt help cause it required a value

is there a way to do it ?


问:
TensorFlow does not recognize gpu. It recognizes only one thing
enter image description here

All gpu versions are the same.

enter image description here

But tensorflow recognizes only No.1 gpu.

I want to know why this is happening.

I use TensorFlow 2.5 version

We've looked at it in many ways, but we've found similar cases.


问:
Convert array of dicts to timestamp-indexed DataFrame
ts should be index (Unix time in milliseconds), column name is random string.

```<code>[
    {'ts': 1669246574000, 'value': '6.06'},
    {'ts': 1669242973000, 'value': '6.5'}
]
</code>```

I would like to have the following output

```<code>DT index         SomeParam
1669242973000    6.5
1669246574000    6.06
</code>```

Instead of

```<code>DT index    ts               SomeParam
0           1669242973000    6.5
1           1669246574000    6.06
</code>```

Body:
ts should be index (Unix time in milliseconds), column name is random string.

[
    {'ts': 1669246574000, 'value': '6.06'},
    {'ts': 1669242973000, 'value': '6.5'}
]

I would like to have the following output

DT index         SomeParam
1669242973000    6.5
1669246574000    6.06

Instead of

DT index    ts               SomeParam
0           1669242973000    6.5
1           1669246574000    6.06


问:
Facing trouble during installation of TensorFlow 2 object detection API
Tried to build Tensorflow 2 object detection API in Ubuntu 20.04 version..
Cuda version:10.1,** Cudnn version:7.6.5 and tensorflow version: 2.2**..
After executing all steps, I had found en error during running one command

I have tried the command

```<code>python -m pip install .
</code>```

" It is installing lots of packages, then it stopped...
Pip version:22.1.0.

Body:
Tried to build Tensorflow 2 object detection API in Ubuntu 20.04 version..
Cuda version:10.1,** Cudnn version:7.6.5 and tensorflow version: 2.2**..
After executing all steps, I had found en error during running one command

I have tried the command

python -m pip install .

" It is installing lots of packages, then it stopped...
Pip version:22.1.0.


问:
AwDataDirLock.java crashes thousands of times
I have a crash that crashes thousands of times for multiple individual users.

This is the crash log directly from Firebase:

```<code>Fatal Exception: java.lang.RuntimeException: Using WebView from more than one process at once with the same data directory is not supported. https://crbug.com/558377 : Current process com.myAppName (pid 16059), lock owner  unknown
   at org.chromium.android_webview.AwDataDirLock.b(AwDataDirLock.java:106)
   at org.chromium.android_webview.AwBrowserProcess.l(AwBrowserProcess.java:143)
   at com.android.webview.chromium.H.e(H.java:206)
   at vd4.run(vd4.java:337)
   at android.os.Handler.handleCallback(Handler.java:873)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:214)
   at android.app.ActivityThread.main(ActivityThread.java:6981)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
</code>```

as you can see below(screenshot from Firebase) I got 5.7k crash for 193 users:

I have been investigating this crash for a very long time and I have tried many solutions.

This usually happens to those who use AdMob, I don't use AdMob and I don't have any third-party libraries that use AdMob.

This is how I initialize the webview:
myApplication.kt onCreate()

```<code>  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
        var processName = getProcessName(applicationContext)
        if (TextUtils.isEmpty(processName)) {
            processName = packageName + "_" + System.currentTimeMillis()
        }
        try {
            WebView.setDataDirectorySuffix(processName!!)
        } catch (exception: Exception) {
            //log
        }
    }

    private fun getProcessName(context: Context?): String? {
    if (context == null) return null
    try {
        val manager = context.getSystemService(ACTIVITY_SERVICE) as ActivityManager
        for (processInfo: ActivityManager.RunningAppProcessInfo in manager.runningAppProcesses) {
            if (processInfo.pid == Process.myPid()) {
                return processInfo.processName
            }
            //log
        }
    } catch (e: Exception) {
        //log
        return null
    }
    return null
}
</code>```

I would be very happy to hear your opinion on why this happens and how it can be solved

Edit: This is the list of devices:

Body:
I have a crash that crashes thousands of times for multiple individual users.

This is the crash log directly from Firebase:

Fatal Exception: java.lang.RuntimeException: Using WebView from more than one process at once with the same data directory is not supported. https://crbug.com/558377 : Current process com.myAppName (pid 16059), lock owner  unknown
   at org.chromium.android_webview.AwDataDirLock.b(AwDataDirLock.java:106)
   at org.chromium.android_webview.AwBrowserProcess.l(AwBrowserProcess.java:143)
   at com.android.webview.chromium.H.e(H.java:206)
   at vd4.run(vd4.java:337)
   at android.os.Handler.handleCallback(Handler.java:873)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:214)
   at android.app.ActivityThread.main(ActivityThread.java:6981)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)

as you can see below(screenshot from Firebase) I got 5.7k crash for 193 users:

I have been investigating this crash for a very long time and I have tried many solutions.

This usually happens to those who use AdMob, I don't use AdMob and I don't have any third-party libraries that use AdMob.

This is how I initialize the webview:
myApplication.kt onCreate()

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
        var processName = getProcessName(applicationContext)
        if (TextUtils.isEmpty(processName)) {
            processName = packageName + "_" + System.currentTimeMillis()
        }
        try {
            WebView.setDataDirectorySuffix(processName!!)
        } catch (exception: Exception) {
            //log
        }
    }

    private fun getProcessName(context: Context?): String? {
    if (context == null) return null
    try {
        val manager = context.getSystemService(ACTIVITY_SERVICE) as ActivityManager
        for (processInfo: ActivityManager.RunningAppProcessInfo in manager.runningAppProcesses) {
            if (processInfo.pid == Process.myPid()) {
                return processInfo.processName
            }
            //log
        }
    } catch (e: Exception) {
        //log
        return null
    }
    return null
}

I would be very happy to hear your opinion on why this happens and how it can be solved

Edit: This is the list of devices:


问:
AWS SNS - SMS failing
I am using AWS SNS service for sending SMS and it is not consistent. For some phone number it works fine but for some phone number it shows an error "providerResponse": "Phone carrier is currently unreachable/unavailable". Sender Code is +91 57575701.

Actually two messages has been sent. First one successfully delivered and second one(within 10 seconds) not delivered to all networks properly.Sometimes its delivered very delayed and sometimes not delivered.

Help me to solve this. How can I successfully sent SMS through AWS SNS.

There is no filtering happening on the device. I have checked. The second SMS content is different than the first one.

Title: AWS SNS - SMS failing


问:
Python swig MT4 error argument 2 of type MTAPI_NOTIFY_FUNC
Please help.
Here's my error:
the function in PumpingSwitch with the name 'pfnFunc'
the type for the parameter void (int): with in another name procedure that have 1 parameter int

Additional information for the paramter:
typedef in the header :

```<code>typedef void (__stdcall MTAPI_NOTIFY_FUNC)(int code))
</code>```

How to send my function to the library that using swig
Error:

```<code>  File "D:\meta-python-connector\model\apimanager\MT4ManagerAPI.py", line 3866, in PumpingSwitch
    return _MT4ManagerAPI.CManagerInterface_PumpingSwitch(self, pfnFunc, destwnd, eventmsg, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'CManagerInterface_PumpingSwitch', argument 2 of type 'MTAPI_NOTIFY_FUNC *'
</code>```

ptyhon
call function:

```<code>res = ExtManagerList[1].PumpingSwitch(Notify_Func, None, 0, 0)
</code>```

the method that need to send

```<code>def Notify_Func(code):
</code>```

Swig generated code:

```<code>SWIGINTERN PyObject *_wrap_CManagerInterface_PumpingSwitch(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  CManagerInterface *arg1 = (CManagerInterface *) 0 ;
  MTAPI_NOTIFY_FUNC *arg2 = (MTAPI_NOTIFY_FUNC *) 0 ;
  HWND arg3 ;
  UINT arg4 ;
  int arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  PyObject *swig_obj[5] ;
  int result;

  if (!SWIG_Python_UnpackTuple(args, "CManagerInterface_PumpingSwitch", 5, 5, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CManagerInterface, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CManagerInterface_PumpingSwitch" "', argument " "1"" of type '" "CManagerInterface *""'");
  }
  arg1 = reinterpret_cast< CManagerInterface * >(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_int__void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "CManagerInterface_PumpingSwitch" "', argument " "2"" of type '" "MTAPI_NOTIFY_FUNC *""'");
    }
  }
  {
    arg3 = (HWND)PyLong_AsVoidPtr(swig_obj[2]);
  }
  {
    arg4 = (unsigned int)PyLong_AsVoidPtr(swig_obj[3]);
  }
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CManagerInterface_PumpingSwitch" "', argument " "5"" of type '" "int""'");
  }
  arg5 = static_cast< int >(val5);
  result = (int)(arg1)->PumpingSwitch(arg2,arg3,arg4,arg5);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}
</code>```

need to success send the method to the library using swig. currently error for trying to send my method in the library parameter.
Thanks for  the any help if available

Body:
Please help.
Here's my error:
the function in PumpingSwitch with the name 'pfnFunc'
the type for the parameter void (int): with in another name procedure that have 1 parameter int

Additional information for the paramter:
typedef in the header :

typedef void (__stdcall MTAPI_NOTIFY_FUNC)(int code))

How to send my function to the library that using swig
Error:

  File "D:\meta-python-connector\model\apimanager\MT4ManagerAPI.py", line 3866, in PumpingSwitch
    return _MT4ManagerAPI.CManagerInterface_PumpingSwitch(self, pfnFunc, destwnd, eventmsg, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'CManagerInterface_PumpingSwitch', argument 2 of type 'MTAPI_NOTIFY_FUNC *'

ptyhon
call function:

res = ExtManagerList[1].PumpingSwitch(Notify_Func, None, 0, 0)

the method that need to send

def Notify_Func(code):

Swig generated code:

SWIGINTERN PyObject *_wrap_CManagerInterface_PumpingSwitch(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  CManagerInterface *arg1 = (CManagerInterface *) 0 ;
  MTAPI_NOTIFY_FUNC *arg2 = (MTAPI_NOTIFY_FUNC *) 0 ;
  HWND arg3 ;
  UINT arg4 ;
  int arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  PyObject *swig_obj[5] ;
  int result;

  if (!SWIG_Python_UnpackTuple(args, "CManagerInterface_PumpingSwitch", 5, 5, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CManagerInterface, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CManagerInterface_PumpingSwitch" "', argument " "1"" of type '" "CManagerInterface *""'");
  }
  arg1 = reinterpret_cast< CManagerInterface * >(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_int__void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "CManagerInterface_PumpingSwitch" "', argument " "2"" of type '" "MTAPI_NOTIFY_FUNC *""'");
    }
  }
  {
    arg3 = (HWND)PyLong_AsVoidPtr(swig_obj[2]);
  }
  {
    arg4 = (unsigned int)PyLong_AsVoidPtr(swig_obj[3]);
  }
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CManagerInterface_PumpingSwitch" "', argument " "5"" of type '" "int""'");
  }
  arg5 = static_cast< int >(val5);
  result = (int)(arg1)->PumpingSwitch(arg2,arg3,arg4,arg5);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}

need to success send the method to the library using swig. currently error for trying to send my method in the library parameter.
Thanks for  the any help if available


问:
Image grid as button in bootstrap
I have 4 images with different sizes. I want to create a grid of 2x2 with each block is equal to each other and it is a clickable image (work as a button). How can I do this in CSS/Bootstrap?

This is what I have tried (in Rails):

```<code><div class="row row-cols-2 main-wrapper px-4">
      <%= link_to students_path, class:"nav-link col btn btn-light center-div" do %>
        <%= image_tag "/assets/bg/cs-ds-bg.jpeg" %>
        <p class="h2">Student stories & Research</p>
      <% end %>
      <%= link_to faculties_path, class:"nav-link col btn btn-light center-div" do %>
        <%= image_tag "/assets/bg/cs-bg.jpeg" %>
        <p class="h2">Faculty & Staff</p>
      <% end %>
      <%= link_to courses_path, class:"nav-link col btn btn-light center-div" do %>
        <p class="h2">Courses</p>
      <% end %>
      <%= link_to requirements_path, class: "nav-link col btn btn-light center-div" do %>
        <p class="h2">Computer Science & Data Science <br>
          Major & Minor Requirements</p>
      <% end %>
    </div>
</code>```

CSS:

```<code>.main-wrapper {
    height: 80vh;
}

.center-div {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0.5px solid #000000;
}
</code>```

This is the image of what it looks right now

Thank you!

Title: Image grid as button in bootstrap

Body:
I have 4 images with different sizes. I want to create a grid of 2x2 with each block is equal to each other and it is a clickable image (work as a button). How can I do this in CSS/Bootstrap?

This is what I have tried (in Rails):

      <%= link_to students_path, class:"nav-link col btn btn-light center-div" do %>
        <%= image_tag "/assets/bg/cs-ds-bg.jpeg" %>

Student stories & Research

      <% end %>
      <%= link_to faculties_path, class:"nav-link col btn btn-light center-div" do %>
        <%= image_tag "/assets/bg/cs-bg.jpeg" %>

Faculty & Staff

      <% end %>
      <%= link_to courses_path, class:"nav-link col btn btn-light center-div" do %>

Courses

      <% end %>
      <%= link_to requirements_path, class: "nav-link col btn btn-light center-div" do %>

Computer Science & Data Science

          Major & Minor Requirements

      <% end %>

CSS:

.main-wrapper {
    height: 80vh;
}

.center-div {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0.5px solid #000000;
}

This is the image of what it looks right now

Thank you!


问:
How to programmatically toggle 'Increase Contrast' feature in Mac Accessibility shortcuts without GUI scripting?
I need to toggle 'Increase Contrast' feature which is available in Accessibility shortcuts via script. For example the below script toggles "Invert Colors" feature:

`

```<code>tell application "System Events"
    key code 28 using {control down, option down, command down}
end tell
</code>```

`
Is there any similar way to toggle Increase Contrast feature which can work on any version of Mac without GUI scripting?

I also didn't find a way to create custom keyboard shortcut for Invert Colors feature

Body:
I need to toggle 'Increase Contrast' feature which is available in Accessibility shortcuts via script. For example the below script toggles "Invert Colors" feature:

`

tell application "System Events"
    key code 28 using {control down, option down, command down}
end tell

`
Is there any similar way to toggle Increase Contrast feature which can work on any version of Mac without GUI scripting?

I also didn't find a way to create custom keyboard shortcut for Invert Colors feature


问:
Fill a solid circle with QCAD dxflib
I use QCAD C++ dxflib to create dxf files.
 I can create circles, but I cannot fill them with a solid hatch. I cannot figure it out from the examples.
 Any idea?

Title: Fill a solid circle with QCAD dxflib