發表文章

標籤消除演算處裡_使用通道分割與二值處裡

圖片
  由於標籤遮蔽導致指針線段偵測失真 只能先補預處裡 進行BGR顏色通道分割 紅色通道 藍色通道 綠色通道 Mat only_blue_label, only_red_label; only_red_label = gray_ori + blue; only_blue_label = gray_ori + red; Mat only_blue_label, only_red_label; //only_red_label = gray_ori + blue; //only_blue_label = gray_ori + red; only_red_label = gray_ori - blue; only_blue_label = gray_ori - red;

C#中nullable的value比對請盡量用雙等號不要用Equals

圖片
  很久前寫過的 深入理解C#(一)_雙等號跟Equals差異_如用於集合中請再記得覆寫GetHashCode 在日常工作Blazor Server開發中 往往只要一有類似exception 比方最常遇到的null exception 就會斷線 因此寫的程式就需要不斷驗證且更加謹慎= =||| 使用Equals在string之間值比對 1 2 3 4 5 6 7 8 9 10 11 try { string str = null ; if (str.Equals( "test" )) { Console.WriteLine( "if" ); } else { Console.WriteLine( "else" ); } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadLine(); 結果會有例外 因為前方為null 再調用.Equals 要將兩邊顛倒 不過左右順序往往還要多加這塊判定其實也比較麻煩 第二種叫建議方式 若是nullable (int? ,short?)或者string 都建議用雙等號比對就不會報null exception程式也較穩定不會有未爆彈 1 2 3 4 5 6 7 8 9 10 11 try { string str = null ; if (str == "test" ) { Console.WriteLine( "if" ); } else { Console.WriteLine( "else" ); } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadLine();

移植C++程式從Visual Studio到Qt Creator報的異常_error: call to 'round' is ambiguous

圖片
  通常是跟數學運算相關的部分 只要記得將傳參補cast轉型float即可

.NET Core與React組合開發技_第03天_增加產品詳細頁元件

圖片
  於~\src\components\ 下新增 一個ProductDetails.js 元件 ~\src\components\ProductDetails.js 程式碼 在此故意做個錯誤示範(缺少return) 1 2 3 4 5 6 import React, { Component } from 'react' ; export default class ProductDetails extends Component { render() { <div>Product Details</div> } } 再到 ~\src\App.js 添加元件路由 ~\src\App.js 程式碼 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 import React, { Component } from 'react' ; import { Route } from 'react-router' ; import { Layout } from './components/Layout' ; import { Home } from './components/Home' ; import { FetchData } from './components/FetchData' ; import { Counter } from './components/Counter' ; import ProductDetails from './components/ProductDetails' ; import './custom.css' export default class App extends Component { static displayName = App.name; render() ...

Azure開發者必備掌握的基本_第02天_App Service_WebApp

圖片
  App Services • 部署和擴展企業級 Web 應用程序、移動後端和 Web API • 在幕後採用虛擬機機制擴增彈性 • 支持縮放 - 手動/自動 • 支持 Java、Node.js、PHP、Python、.NET 和 Ruby • 無前期成本 • 無終止費 • 按秒計費 支援許多不同型態的App服務(像是API App或Web App) App Services 本身會隨不同服務層級會有相應不同資源使用上限與費用 Limitations of App Services • App Service on Linux is not supported on Shared pricing tier. • Windows and Linux apps can’t be mixed in the same App Service plan. • Within the same resource group, you can't mix Windows and  Linux apps in the same region. WebApp • 提供PaaS 存取方式來託管 Web 應用程序、API. • 提供 auto-scaling, manual scaling and high availability • SLA 99.95% • Custom Domains • Deployment Slots • Windows 和 Linux雙系統接有提供 • 支援 GitHub, Azure Repos, or Git repo等持續交付版控的平台 在傳統主機需地端自行納管上就需要考量電費,人力成本跟機房租用等預先要投入且無彈性也無法即時調控的成本 相應採用雲端優點就在於可彈性調配所需資源也省去很多看不見的成本 在此可觀察到可選用之應用程式語言和框架支援十分多元 Windows方案可以新建或者沿用既有的 在此由於SKU和大小選擇F1免費方案因此後續頁籤很多功能都會鎖住 這邊可以嘗試去啟用部分用多少算多少的服務方案 https://azure.microsoft.com/zh-tw/pricing/details/app-service/windows/ 切到D1小試身手(預設會自動帶S1 費用有差要注意!!!) 到B1才開始提供SSL 在S1由於...

.NET Core與React組合開發技_第02天_調整React範本產生產品列表清單_JSX、元件狀態介紹

圖片
在此微調Home.js 來做測試 可在Home 元件進行建構子中state初始化 state(狀態)就像 ReactJS 組件的資料狀態暫存。 state management(狀態管理)只能在類組件(Class Component)中進行。 Function Components(功能組件)是stateless(無狀態)組件。 異動render達到react js中的 data bind ~\MyReact1\ClientApp\src\components\Home.js 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 import React, { Component } from 'react' ; export class Home extends Component { static displayName = Home.name; constructor(props) { super (props); this .state = { products: [ { title: "some product" , description: "interesting" }, { title: "another product" , description: "more" } ] }; } render() { return ( <div className= "row" > { this .state.products.map(product => <div className= "col-4" > ...

Azure開發者必備掌握的基本_第01天_Azure與雲運算大致介紹

圖片
Azure平台本身有一個趨勢 從原先 面向服務的管理模式(Azure Service Management),ASM 漸漸要驅使人員轉到 面向資源的管理模式(Azure Resource Management),ARM https://docs.microsoft.com/zh-tw/azure/virtual-machines/migration-classic-resource-manager-overview 何謂 Resource Manager? • A deployment and management service for Azure. • Provides a management layer that enables you to create, update, and delete resources in your Azure account. • Provides management features, like access control, locks, and tags, to secure and organize your resources after deployment. • Define the dependencies between resources so that they're deployed in the correct order 什麽是Resource(資源) ARM模式下所有資源都是松耦合的組件(可配置,可擴展,可組合,獨立生命周期) ARM模式下可使用基於JSON格式的模板文件 什麽是Resource Group (資源組) 為便於管理,將資源按照生命周期進行邏輯的組合 一個資源只能屬於一個資源組,但可以在資源組之間移動 資源組可以包含不同區域的資源 資源之間的互聯互通和資源組的劃分沒有關系 • An ARM resource can exist only in one resource group. • A resource group is created in a region and it can have the resources from the other regions. • Resources can be moved between resource groups. •...

.NET Core與React組合開發技_第01天_前言_專案建立與大致介紹

圖片
  2022鐵人賽第一天文章,讀者朋友們好 來稍微探究一下於asp.net core中搭配React前端框架的開發 在這30天成蝶的過程 我想React本身很重ES6和Javascript一些基本語法 算還滿適合拿來當三框架中先拿來進行掌握的一門 (但也是最難掌握也很多人不太推先學的XD) 勉勵自己也將知識專業進行傳播 如文章對於你(可能是個小白)也可能是 只會React但不曉得如何結合.NET Core後端的 又或者只會.NET Core後端但不曉得怎麼和React進行結合的 我希望這系列文章 是個對上述這些開發者戰友們或者以往家教學員 有幫助讀起來不會吃力也很容易吸收的技術篇章 此系列會使用 NodeJs 16以上 和 visual studio 2022  (.Net6長期支援版本) 會在Windows作業系統上做筆記文章 當然若是Mac愛好者的朋友.Net Core (.Net6)也以克服跨作業系統的限制 並不侷限於Windows OS 但Mac環境有關visual studio相關操作可能就都要用cli和vscode來搭配了 因為Mac上的Visual Studio for Mac我較沒接觸 請各位先準備好上述這些IDE和開發環境 有任何誤植或者觀點不認同皆可進行一些開發經驗分享 和批評指教一同成長 開啟vs2022創建第一個React.js配asp.net core的新專案 在此去命名專案名稱默認會配有一個.csproj(C#的專案檔)和.sln(方案) 方案中可包含一或多個專案 選.NET6.0 預設新專案建立好後就可看到如下專案結構 有默認範本的asp.net core web api(相關先備知識可參閱 過去技術部落格貼文 ) 於此系列可能就會稍微帶過 可以觀察到專案目錄下有一份前端的專案檔 裡面有熟悉的NodeJs package.json 於後端C#專案中的範疇 主程式進入點會在Program.cs當中 ~\MyReact1\Program.cs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 var builder = WebApplication.CreateBuilder(args); // Add se...