EExcel 丞燕快速查詢2

EExcel 丞燕快速查詢2
EExcel 丞燕快速查詢2 https://sandk.ffbizs.com/

Two dimensional Array unique


$goods = [
  1 => [
    'id' => 12,
    'price' => 77,
  ],
  2 => [
    'id' => 43,
    'price' => 855,
  ],
  4 => [
    'id' => 34,
    'price' => 1,
  ],
];

$goods_unique_ids_keys = array_keys(array_unique(array_column($goods, 'id')));
$goods_filter_datas = array_filter($goods, fn($key) => in_array($key, $goods_unique_ids_keys), ARRAY_FILTER_USE_KEY);
        

Livewire form and outside form with button action maybe different your think

In liveiwre word some button action and alpine @click action be clicked, livewire 3 update (ajax) is different your think. Component

    public $test_input=1;

    public function tt()
    {
        info('tt');
        info($this->test_input);
    }
blade

        <div class="row row-cols-1 row-cols-md-3 g-4" x-data>
            <form wire:submit="tt">
                <input type="text" wire:model='test_input'>
                <button type="submit">form type=submit</button> {{-- // update (ajax) --}}
                <button type="button">form type=button</button> {{-- // No update (ajax) --}}

                <button wire:click='tt; $wire.test_input=3;'>form wire:click</button> {{-- // update (ajax) and run twice --}}
                <button @click='$wire.tt; $wire.test_input=3;'>form @click</button> {{-- // update (ajax) and run twice --}}
            </form>

            <button type="submit">out form type=submit</button> {{-- // No update (ajax) --}}
            <button type="button">out form type=button</button> {{-- // No update (ajax) --}}

            <button wire:click='tt; $wire.test_input=3;'>out form wire:click</button> {{-- // update (ajax)  --}}
            <button @click='$wire.tt; $wire.test_input=3;'>out form @click</button> {{-- // update (ajax)  --}}
        </div>
So be careful and try to understand
1. what time public variable have value or be set value
2. run twice, not run one.

[轉] Powershell Script for Sending Email via Remote SMTP

https://tecadmin.net/powershell-sending-email-via-smtp/

# Define the sender, recipient, subject, and body of the email
$From = "sender@example.com"
$To = "recipient@example.com"
$Subject = "Test Email"
$Body = "This is a test email sent via remote SMTP using PowerShell."
 
# Define the SMTP server details
$SMTPServer = "smtp.example.com"
$SMTPPort = 587
$SMTPUsername = "username"
$SMTPPassword = "password"
 
# Create a new email object
$Email = New-Object System.Net.Mail.MailMessage
$Email.From = $From
$Email.To.Add($To)
$Email.Subject = $Subject
$Email.Body = $Body
# Uncomment below to send HTML formatted email
#$Email.IsBodyHTML = $true
 
# Create an SMTP client object and send the email
$SMTPClient = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort)
$SMTPClient.EnableSsl = $true
 
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential($SMTPUsername, $SMTPPassword)
$SMTPClient.Send($Email)
 
# Output a message indicating that the email was sent successfully
Write-Host "Email sent successfully to $($Email.To.ToString())"

gitlab runner 【x509: certificate relies on legacy Common Name field, use SANs instead】 And 【x509: certificate signed by unknown authority】

https://gitlab.com/gitlab-org/gitlab-runner/-/issues/28841

【x509: certificate relies on legacy Common Name field, use SANs instead】

1. Change all example.com for your domain

openssl genrsa -out ca.key 2048

openssl req -new -x509 -days 365 -key ca.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=Acme Root CA" -out ca.crt

openssl req -newkey rsa:2048 -nodes -keyout example.com.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=*.example.com" -out example.com.csr

openssl x509 -req -extfile <(printf "subjectAltName=DNS:example.com,DNS:www.example.com") -days 365 -in example.com.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out example.com.crt

2. Put crt and key to gitlab ssl. Stop gitlab. Start gitlab.

Check gitlab have new DNS

openssl s_client -connect example.com:443 /dev/null | openssl x509 -noout -text | grep DNS:
3. if have 【x509: certificate signed by unknown authority】


gitlab-runner register --tls-ca-file="Use just create crt file"

laravel socialite line How to

Thank

https://medium.com/laravel-news/adding-auth-providers-to-laravel-socialite-ca0335929e42

This have problems https://socialiteproviders.com/Line/

1.


composer require socialiteproviders/line

2. create app/Providers/LineProvider.php

https://github.com/SocialiteProviders/Line/blob/master/Provider.php


namespace App\Providers;

use GuzzleHttp\RequestOptions;
use Laravel\Socialite\Two\InvalidStateException;
use \SocialiteProviders\Manager\OAuth2\AbstractProvider;
use \SocialiteProviders\Manager\OAuth2\User;

class LineProvider extends AbstractProvider
{
    public const IDENTIFIER = 'LINE';

    /**
     * The separating character for the requested scopes.
     *
     * @var string
     */
    protected $scopeSeparator = ' ';

    /**
     * The scopes being requested.
     *
     * @var array
     */
    protected $scopes = [
        'openid',
        'profile',
        'email',
    ];

    /**
     * Get the authentication URL for the provider.
     *
     * @param  string  $state
     * @return string
     */
    protected function getAuthUrl($state)
    {
        return $this->buildAuthUrlFromBase(
            'https://access.line.me/oauth2/v2.1/authorize',
            $state
        );
    }

    /**
     * Get the token URL for the provider.
     *
     * @return string
     */
    protected function getTokenUrl()
    {
        return 'https://api.line.me/oauth2/v2.1/token';
    }

    /**
     * Get the raw user for the given access token.
     *
     * @param  string  $token
     * @return array
     */
    protected function getUserByToken($token)
    {
        $response = $this->getHttpClient()->get(
            'https://api.line.me/v2/profile',
            [
                RequestOptions::HEADERS => [
                    'Authorization' => 'Bearer '.$token,
                ],
            ]
        );

        return json_decode((string) $response->getBody(), true);
    }

    /**
     * Map the raw user array to a Socialite User instance.
     *
     * @param  array  $user
     * @return \Laravel\Socialite\User
     */
    protected function mapUserToObject(array $user)
    {
        return (new User())->setRaw($user)->map([
            'id'       => $user['userId'] ?? $user['sub'] ?? null,
            'nickname' => null,
            'name'     => $user['displayName'] ?? $user['name'] ?? null,
            'avatar'   => $user['pictureUrl'] ?? $user['picture'] ?? null,
            'email'    => $user['email'] ?? null,
        ]);
    }

    // /**
    //  * Get the POST fields for the token request.
    //  *
    //  * @param string $code
    //  *
    //  * @return array
    //  */
    // protected function getTokenFields($code)
    // {
    //     return array_merge(parent::getTokenFields($code), [
    //         'grant_type' => 'authorization_code',
    //     ]);
    // }

    /**
     * @return \SocialiteProviders\Manager\OAuth2\User
     */
    public function user()
    {
        if ($this->hasInvalidState()) {
            throw new InvalidStateException();
        }

        $response = $this->getAccessTokenResponse($this->getCode());

        if ($jwt = $response['id_token'] ?? null) {
            $bodyb64 = explode('.', $jwt)[1];
            $user = $this->mapUserToObject(json_decode(base64_decode(strtr($bodyb64, '-_', '+/')), true));
        } else {
            $user = $this->mapUserToObject($this->getUserByToken(
                $token = $this->parseAccessToken($response)
            ));
        }

        $this->credentialsResponseBody = $response;

        if ($user instanceof User) {
            $user->setAccessTokenResponseBody($this->credentialsResponseBody);
        }

        return $user->setToken($this->parseAccessToken($response))
            ->setRefreshToken($this->parseRefreshToken($response))
            ->setExpiresIn($this->parseExpiresIn($response));
    }
}

3. edit app/Providers/AppServiceProvider.php


namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        $this->bootLineSocialite();
    }

    public function bootLineSocialite(): void
    {
        // // laravel Socialite 和 Socialite Line 有問題,就是 在初始載入不了
        // // 看Socialite Line 作者還有在3星期前維謢,所以就不知道怎麼回事
        // // https://medium.com/laravel-news/adding-auth-providers-to-laravel-socialite-ca0335929e42
        $socialite = $this->app->make('Laravel\Socialite\Contracts\Factory');

        $socialite->extend(
            'line',
            function ($app) use ($socialite) {
                $config = config('services.line');

                // https://github.com/SocialiteProviders/Line/blob/master/Provider.php
                return $socialite->buildProvider(LineProvider::class, $config); // \SocialiteProviders\Line\Provider::class
            }
        );
    }
}

4. routes/web.php


Route::get('/auth/redirect', function () {
    return Socialite::driver('line')->redirect();
});

Route::get('/auth/callback', function () {
    $user = Socialite::driver('line')->user();

    dd($user);
});

[轉]美国教授在雅典论坛上,为中国说点公道话,让香港学生差点喘不过气来【视频11分9秒处】

https://www.youtube.com/watch?v=aYTsDSoePGI

@tanguemaxime4706 5 個月前 (已編輯)

我出生在中国农村,经历过根植于我记忆中的贫穷;大学之后赴法国学习、生活和工作了15年;后来又在不同的非洲国家工作了多年。我去过30个不同的亚洲、非洲欧洲国家,包括绝大多数东欧国家。我是历史和哲学系出身,我的爱人是哲学本科出身而且硕士和博士都是研究中国政治和法律系统的法国汉学家,她的专业也为了提供了很特别和有价值的视角。我非常赞同这位教授的基本观点:

首先西方一直试图告诉人们这个世界的主要矛盾就是民主和专制的斗争,但是事实远非如此。如果你在非洲最贫困和混乱的国家诸如乍得、中非共和国、马里等地居住过,你才能明白世界的现实究竟是什么。世界的主要矛盾是新自由主义指导下的全球化在世界范围内的不公。这种不公被诸如知识产权、强权利益引导的军事和政治干预等诸多因素决定,在第三世界导致大量的赤贫、污染、动荡。绝大多数国家在全球化分工体系中都不能突破技术壁垒,只能被迫居于工业增值链的最低端。西方霸权会在任何场合提及“民主-独裁”问题,但不会把“每年全世界5岁以下的儿童因饥饿和营养不良死亡3到5百万”这个问题放在人类亟待解决的首位。因为对后者的分析才会揭示这个世界真正的主要矛盾在哪里,会动摇西方主导的全球化秩序。这个世界的基础是财富的创造(生产力)和财富的分配机制(生产关系),很多发达世界的年轻人根本没承受过真正的苦难,被西方政治宣传洗脑的香港年轻人也是这样,就像温室里的花,以为“民主”是一切病症的中心,说出来的都是那种“何不食肉糜”的蠢话。

第二,民主或者不民主本来就是一个非常复杂而且在历史中不断变动的概念。这些东西是“理念”,而不是可以客观观察的“一只猫”或者“一条狗”,其内涵不是不变的,而是不同时代的人们反思他们的时代,从而为其不断注入或者减去内涵。熊彼得之前和熊彼得之后的民主能是一样的吗?希腊的民主和当代的民主是一样的吗?这个教授说的很好,政治形式更值得关注的是细节,有那么多细节需要讨论和关注。要真正讨论民主自由这些东西,你至少要从古希腊、博丹、格劳秀斯、启蒙运动、康德、黑格尔一路读到以赛亚柏林、波普、熊彼得。但是这太难了,对于那些只知道喊口号的懒惰的年轻人而言。

第三,历史传统。我记得以前上学的时候有个法国教授跟我们说:如果西方对于中国的政治史有一些基本了解的话,那么就应该谦虚一些。中国唐代中书、门下、尚书省和皇帝在诏书的颁布和实施就已经非常具有严谨的制衡机制;谏台、监察等制度;中央和地方的关系、军制、劳役和税制等等,都是复杂和让人惊叹的严谨。很多知识匮乏的年轻人就觉得西方那套照搬到什么地方都好用,完全看不到这套制度在绝大多数地方的运行都是失败的。实际上,政治制度之于政治文化就像一个外壳、表象,或者冰山露出水面的部分。没有外力干扰的情况下,政治文化会自然的孕育政治制度。而政治文化是民族千百年来积累下来的、有机态的生长的结果。它是根植于血肉和土地的东西。比如利比亚,就是独特的历史和地理环境造成了这个国家以贝都因人部族为单位形成了一个复杂的制衡、联姻、竞争的权力和利益分配体。这是深层的政治文化,产生于千百年来“人”和“历史”、“地理”、“生产技术”的磨合。西方要在利比亚搞西方民主,那就是个表皮,这个表皮下面继续运作的还是原来的政治文化。西方的制度之所以在西方适合也是因为他们经历了一千多年从中世纪以来特别是200多年以来的各种摸索和磨合建立起来的,很多西方政治的机制都能在中世纪甚至更早的时代找到根源。政治制度的有效运行需要同历史、经济现实以及政治文化相契合。

最后,我想补充一点个人的看法。中国人并非一个封闭的民族,我们从古至今都不排斥学习别的民族。民主、自由、公平、正义、主权在民等等现代政治学的理念我们并不排斥。马克思也是西方的,中国排斥了吗?我们反对的是将它们神话,或者形而上学化。

周虽旧邦其命维新,古老的中华民族之所以能够穿越几千年还能保持其活力,根本就在于能够同时兼顾两个方面,即“接受新鲜的合理事物”同时又能“不失其本体”。

孙中山接受了民族主义,但是能很快适应中国的现实转而宣传“五族共和-中华民族”;毛泽东的革命胜利建立在对于马克思主义的修正使其的中国化,反对“教条主义”,走农村路线,而不是死板地依靠工人阶级;邓小平的改革开放也是将西方的市场经济融入马克思理论。一个民族但凡对于自身的智慧有一点信心,也要会动动脑子,不至于像个脑瘫一样照囫囵吞枣,闭着眼睛搬照抄别人的。