[windows]將 Windows 自動更新暫停到 2051 年 12 月 31 日 – Windows Update Killer

參考網址:將 Windows 自動更新暫停到 2051 年 12 月 31 日 – Windows Update Killer | UNIKO's Hardware

下載

Releases · Aetherinox/windows-update-killer

由於 Windows 10 和 Windows 11 家用版不提供關閉自動更新的功能,最多透過暫停更新去延長下次進行更新的時間,使用者只能依賴其他方式去避免更新。先前分享過 StopUpdates10 與 Windows Update Blocker 兩款自動更新關閉工具,考量到有些人不想使用第三方工具,因此分享國外網友製作的登錄檔,使用後可以暫停更新至 2051 年 12 月 31 日喔!
如果沒使用登錄檔,家用版最多暫停 5 週。

發表於 Windows系統 | 發表迴響

[excel]秩序冊出場序版面產生器

參考網址:李坦闊老師FB https://www.facebook.com/tancle.taiwan
下載點 http://bit.ly/3gjxD0S
使用教學 影片說明 https://youtu.be/Qj-HtxSDvM0
本系統是在Fb社團「Excel 函數教學 & 討論」發問,由「陳鴻儒」先生撰寫原始碼,「閃鈴教室」做些微修改後,無償提供大眾使用。

發表於 Windows系統, 程式設計 | 發表迴響

[php]php 8 How to solve this error? strlen(): Passing null to parameter #1 ($string) of type string is deprecated in

參考網址:question2answer

Before PHP 8.1:

echo strlen(null); // No deprecation notice is shown up.
// -> 0

As of PHP 8.1:

echo strlen(null); // Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in ... on line ...
// -> 0

Solution

The RFC describing this issue is really helpful for possible resolutions and I highly recommend reviewing it. As of Question2Answer, the official resolution was to make use of the Null Coalescing Operator (??) when possible; here is an example from GitHub, which replaces:

if (strlen($error )) {...}

with this:

if (strlen($error ?? '')) {...}

This effectively fixes the issue.

 

合併運算子(??)
php7開始支援
PHP 7 新特性二Null coalescing operator(空合并运算符)
空值合併運算子

如要相容於php5.6得改掉「??」
 

https://github.com/tad0616/tadnews/commit/master
修正PHP5.x會出錯的問題
$result['of_ncsn'][$ncsn] = $page['of_ncsn'] ?? $the_ncsn;
$result['of_ncsn'][$ncsn] = isset($page['of_ncsn']) ? $page['of_ncsn'] : $the_ncsn;

 

發表於 程式設計 | 發表迴響

[php][ajax]一個不錯的table界面

參考網址:https://datatables.net/

網路閒晃,意外發現。

Add advanced interaction controls to your HTML tables the free & easy way

發表於 軟體使用 | 發表迴響

[php]升級到PHP8之後的調整

參考網址:https://fannys23.pixnet.net/blog/post/48239316

配合 PHP 8 停止支援 __autoload(),改用 sql_autoloaod_register()

配合 PHP 8 停用 each(),改用 foreach()
錯誤訊息:PHP Fatal error:  Uncaught Error: Call to undefined function each()
while(list(, $line) = @each($lines)) {
改寫為:
foreach ($lines as $line) {

 

在 PHP 8 要對 PHPExcel 做的調整:

  1. 陣列元素不可再使用大括號 {} 操作,需要使用中括號 []

     

     

     

     

     

     

     

    • 錯誤訊息:PHP Fatal error:  Array and string offset access syntax with curly braces is no longer supported
    • 原本在 PHP 7 的寫法為:
      $str = array(1, 2, 3);
      $test = $str{0};
      改寫為:
      $str = array(1, 2, 3);
      $test = $str[0];
       
  2. 在 DefaultValueBinder.php 出現 "Trying to access array offset on value of type int",依照  stackoverflow 的上的討論,我將第 86 行由:

     

     

     

     

     

     

     

    } elseif ($pValue[0] === '=' && strlen($pValue) > 1) {

    改為:

    } elseif (0 === strpos($pValue, '=') && strlen($pValue) > 1) {

 

https://forum.gamer.com.tw/C.php?bsn=60292&snA=8686
解決count()的錯誤
 

原本在PHP7能運行的count()程式段,在PHP8會報error

Exception: count(): Argument #1 ($value) must be of type Countable|array, null given
 

報錯原因

因為count()在PHP8需要是array或是countable,否則會報TypeError

在PHP7時期只會跳warning

https://www.php.net/manual/en/function.count.php
 

解決方案

第一種:先作宣告

於第425行後加上以下兩條

$new_Timestamp = [];

$new_TimestampTitle = [];

 

第二種:加上is_countable()

將434的if(count($new_TimestampTitle)>0){

改為if (is_countable($new_TimestampTitle) && count($new_TimestampTitle) > 0) {

 

 

調整sport/ns到php8.1.2(ubuntu 22.04預設php版本)
 

adodb升級至v5.22.7
 
include/config.php 修正
​//Smarty 偵錯
define('DEBUG' , 'false') ;

比較麻煩的是這個錯誤
Fatal error: Uncaught Error: Undefined constant "play_group_level_id" in /var/www/html/ns/sum/sum_item.php:20 Stack trace: #0 {main} thrown in /var/www/html/ns/sum/sum_item.php on line 20
陣列的索引值如果是文字則必需有''包住,之前的版本只是會提出警告,php8直接給Fatal error
例如:$sys_conf[play_place] 必需改為$sys_conf['play_place']

用sublime text正則表示式找陣列,以「$」開頭,以「[」結束的字串
\$(\w+)\[
\w matches any word character (equivalent to [a-zA-Z0-9_])

\$(\w+)\[(\w+)] 

 

 

 

發表於 Linux系統, 程式設計 | 發表迴響

[php]PhpSpreadsheet 相關文件

參考網址:徐嘉裕(Neil Hsu)的工作心得網誌!

PHPExcel套件最後一版是2015年寫的,目前已不再更新。
https://github.com/PHPOffice/PHPExcel
為了因應越來越複雜的Excel版本,得找找有沒有可以替代的套件。

這是PHPExcel的後續套件PHPSpreadSheet
https://github.com/PHPOffice/PhpSpreadsheet/

徐嘉裕(Neil Hsu)的工作心得網誌!
唯一比較麻煩的是使用PhpSpreadsheet要先佈署composer,如果沒佈署composer是沒辦法使用的,還好官方有釋出已經設定好的phpoffice套件可以直接引入使用,省了很多麻煩
https://neohsuxoops.blogspot.com/2020/09/phpspreadsheetphpexcel-xoops.html
 

PhpSpreadsheet套件下載
https://drive.google.com/file/d/1jw73diWVjbcr1ycY-gtqM2cGfpLp1zS_/view?usp=sharing
下載回來後解壓縮把phpoffice跟PhpSpreadsheet丟到class資料夾中,未來如需更新PhpSpreadsheet可到官網下載最新版覆蓋即可

 

 

使用說明https://phpspreadsheet.readthedocs.io/en/latest/

read 範例(php 7.4)( 在php5.6測試有問題)

<?php
include_once 'class/phpoffice/vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\IOFactory;

//require __DIR__ . '/../Header.php';

//$inputFileName = __DIR__ . '/sampleData/example1.xls';
//$inputFileName = __DIR__ . '/good-example.xlsx';
$inputFileName = __DIR__ . '/1103289.xls';
//$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory to identify the format');
$spreadsheet = IOFactory::load($inputFileName);

$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
//$helper->displayGrid($sheetData);

print_r($sheetData);

 

發表於 程式設計 | 發表迴響

[hyper-v]Win11 家用版如何安裝 Hyper-V虛擬機

參考網址:https://kkplay3c.net/windows-installs-hyperv/

win11 家用版是不支援hyper-v的,得自己裝。
 

pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL

 

存成cmd,以系統管理員身分執行。

裝好後執行Hyper-v管理員

相關功能:開啟或關閉Windows功能

發表於 Windows系統 | 發表迴響

Thunderbolt™ 4與USB4

參考網址:https://www.allion.com.tw/tech_cable_usb4-tbt4_compare/

USB4 和 Thunderbolt™ 4功能強大且便利性高,兩者皆以USB Type-C作為統一介面,都只需要一條線便能做到畫面顯示、充電、資料傳輸等多項功能。

不論是從外觀還是功能,USB4 和Thunderbolt™4都有許多的相似之處,想要分辦出兩者之間的差別確實也沒那麼容易。

發表於 硬體維修 | 發表迴響

[CPU]Intel Core 處理器的型號要怎麼看? CPU 要怎麼選?

參考網址:https://chci.com.tw/what-is-intel-core/

Intel Core Ultra 5 125H(14核心 18執行緒)

https://www.mobile01.com/topicdetail.php?f=296&t=6889972

H 系列採用最高 6P+8E+2 LP E 核心配置,最大加速時脈為 5.0 GHz,快取記憶體配置則是 24MB、顯示核心則是搭載 Arc 顯示晶片,具備 8 核心/7 核心配置,最大運作功耗則是 115W。另外在明年第一季還會有一款更高階的 Core Ultra 9 185H 處理器登場,最高時脈可拉到 5.1 GHz。

發表於 硬體維修 | 發表迴響

[ubuntu][php][ppa]ppa:tomvlk/php-archive備份

ppa:ondrej/php 已不支援ubuntu 16.04 目前(2024/12/04)可以在ppa:tomvlk/php-archive找到相關的deb
這些deb應該也是ondrej整理的
add-apt-repository ppa:tomvlk/php-archive
擔心以後這個資源也會不見,所以就想個辦法把這些deb備份下來

在這個頁面可以看到檔案列表
http://ppa.launchpadcontent.net/tomvlk/php-archive/ubuntu/pool/main/p/php5.6/
php5.6_5.6.40-6+ubuntu16.04.1+deb.sury.org+3_all.deb    2019-04-26 12:33     257K
php5.6_5.6.40-6+ubuntu18.04.1+deb.sury.org+3_all.deb    2019-04-26 12:37     257K
php5.6_5.6.40-6+ubuntu19.04.1+deb.sury.org+3_all.deb    2019-04-26 12:40     257K 
從列表中可以發現它可以支援ubuntu 16.04 、18.04、19.04

我們用wget把這個資源砍下來備份,以備不時之需。
wget -mpkP ./ http://ppa.launchpadcontent.net/tomvlk/php-archive/ubuntu/pool/main/p/php5.6/

可以運用以下連結
http://163.26.179.2/php56/ppa.launchpadcontent.net/tomvlk/php-archive/ubuntu/pool/main/p/index.html

相關貼文:[php]ppa 在lubuntu 16.04 支援 php5.6
http://sp.idv.tw/wp/index.php/2023/03/21/1786/

發表於 Linux系統, 程式設計 | 發表迴響