Haskell 安装 Cairo

背景

Haskell 项目需要使用到柱状图,折线图等(demo 代码)

步骤(默认已安装 stack, cabal, ghcup)

nameversion
stack2.11.1
cabal3.8.1.0
ghcup0.1.20.0
  1. 在 package.yaml 中添加所需依赖 Chart 和 Chart-cairo
name:                a
version:             0.1.0.0
github:              "githubuser/a"
license:             BSD-3-Clause
author:              "Author name here"
maintainer:          "example@example.com"
copyright:           "2023 Author name here"

extra-source-files:
- README.md
- CHANGELOG.md

# Metadata used when publishing your package
# synopsis:            Short description of your package
# category:            Web

# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description:         Please see the README on GitHub at <https://github.com/githubuser/a#readme>

dependencies:
- base >= 4.7 && < 5

ghc-options:
- -Wall
- -Wcompat
- -Widentities
- -Wincomplete-record-updates
- -Wincomplete-uni-patterns
- -Wmissing-export-lists
- -Wmissing-home-modules
- -Wpartial-fields
- -Wredundant-constraints

library:
  source-dirs: 
  - src
  - app
  dependencies: 
  - bytestring
  - http-conduit
  - sqlite-simple
  - Chart
  - text
  # - Chart-diagrams
  # - diagrams
  # - diagrams-svg
  # - diagrams-lib
  - colour
  - data-default-class
  # common
  - Chart-cairo
  - lens
  - aeson
  - stm
  - split
  - text
  - time
  - binary
  - binary-orphans
  - old-locale
  - directory
  - pretty-simple
  - string-conversions

executables:
  a-exe:
    main:                Main.hs
    source-dirs:         app
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - a
    - sqlite-simple
    - Chart
    - text
    - bytestring
    # - Chart-diagrams
    # - diagrams
    # - diagrams-svg
    # - diagrams-lib
    - colour
    - data-default-class
    # common
    - Chart-cairo
    - lens
    - aeson
    - stm
    - split
    - text
    - time
    - binary
    - binary-orphans
    - old-locale
    - directory
    - pretty-simple
    - string-conversions

tests:
  a-test:
    main:                Spec.hs
    source-dirs:         test
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - a

运行 stack-build,编译失败,大概提示未指定 cairo 版本。

  1. 在 stack.yaml 中添加 chart 版本信息
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/

# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
#
# The location of a snapshot can be provided as a file or url. Stack assumes
# a snapshot provided as a file might change, whereas a url resource does not.
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
# resolver: lts-21.13
resolver: lts-21.13
  # url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/22.yaml

# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
#   subdirs:
#   - auto-update
#   - wai
packages:
- .
# Dependency packages to be pulled from upstream that are not in the resolver.
# These entries can reference officially published versions as well as
# forks / in-progress versions pinned to a git hash. For example:
#
# extra-deps:
# - acme-missiles-0.3
# - git: https://github.com/commercialhaskell/stack.git
#   commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
#
# extra-deps: []

# Override default flag values for local packages and extra-deps
# flags: {}

# Extra package databases containing global packages
# extra-package-dbs: []

# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of Stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=2.11"
#
# Override the architecture used by Stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by Stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor
extra-deps:
- Chart-1.9.5
- Chart-cairo-1.9.4.1

flags: {}

extra-package-dbs: []

运行 stack build,报错。

ErrorTrace:

cairo      > configure
cairo      > [1 of 3] Compiling Main             ( C:\Users\df366\AppData\Local\Temp\stack-96faf9bec5d62ffb\cairo-0.13.10.0\Setup.hs, C:\Users\df366\AppData\Local\Temp\stack-96faf9bec5d62ffb\cairo-0.13.10.0\.stack-work\dist\22605e11\setup\Main.o )
cairo      > [2 of 3] Compiling StackSetupShim   ( C:\sr\setup-exe-src\setup-shim-9p6GVs8J.hs, C:\Users\df366\AppData\Local\Temp\stack-96faf9bec5d62ffb\cairo-0.13.10.0\.stack-work\dist\22605e11\setup\StackSetupShim.o )
cairo      > [3 of 3] Linking C:\Users\df366\AppData\Local\Temp\stack-96faf9bec5d62ffb\cairo-0.13.10.0\.stack-work\dist\22605e11\setup\setup.exe
cairo      > Configuring cairo-0.13.10.0...
cairo      > Error: setup.EXE: The pkg-config package 'cairo' version >=1.2.0 is required
cairo      > but it could not be found.
cairo      >
Progress 1/3

Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the error:

       [S-7011]
       While building package cairo-0.13.10.0 (scroll up to its section to see the error) using:
       C:\Users\df366\AppData\Local\Temp\stack-96faf9bec5d62ffb\cairo-0.13.10.0\.stack-work\dist\22605e11\setup\setup --verbose=1 --builddir=.stack-work\dist\22605e11 configure --with-ghc=C:\Users\df366\AppData\Local\Programs\stack\x86_64-windows\ghc-9.4.7\bin\ghc-9.4.7.exe --with-ghc-pkg=C:\Users\df366\AppData\Local\Programs\stack\x86_64-windows\ghc-9.4.7\bin\ghc-pkg-9.4.7.exe --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\9095fbbf\pkgdb --libdir=C:\sr\snapshots\9095fbbf\lib --bindir=C:\sr\snapshots\9095fbbf\bin --datadir=C:\sr\snapshots\9095fbbf\share --libexecdir=C:\sr\snapshots\9095fbbf\libexec --sysconfdir=C:\sr\snapshots\9095fbbf\etc --docdir=C:\sr\snapshots\9095fbbf\doc\cairo-0.13.10.0 --htmldir=C:\sr\snapshots\9095fbbf\doc\cairo-0.13.10.0 --haddockdir=C:\sr\snapshots\9095fbbf\doc\cairo-0.13.10.0 --dependency=Cabal=Cabal-3.8.1.0 --dependency=array=array-0.5.4.0 --dependency=base=base-4.17.2.0 --dependency=bytestring=bytestring-0.11.5.2 --dependency=gtk2hs-buildtools=gtk2hs-buildtools-0.13.10.0-7OxGn4htize3gcv93EYR9n --dependency=mtl=mtl-2.2.2 --dependency=text=text-2.0.2 --dependency=utf8-string=utf8-string-1.0.2-KqazO8nUWrDMJ2shK7HoQ -fcairo_pdf -fcairo_ps -fcairo_svg --ghc-options -haddock --extra-include-dirs=C:\Users\df366\AppData\Local\Programs\stack\x86_64-windows\msys2-20230526\mingw64\include --extra-lib-dirs=C:\Users\df366\AppData\Local\Programs\stack\x86_64-windows\msys2-20230526\mingw64\lib --extra-lib-dirs=C:\Users\df366\AppData\Local\Programs\stack\x86_64-windows\msys2-20230526\mingw64\bin --exact-configuration --ghc-option=-fhide-source-paths
       Process exited with code: ExitFailure 1

提示 gcc 自带的 pkg-config 没有高于 1.2.0 的 cairo 包

  1. 安装 MSYS2, 并配置 Path, 目的是用到 MSYS2 中的 pkg-config.
    在这里插入图片描述
    安装相关工具
# gcc
pacman -S mingw-w64-ucrt-x86_64-gcc

# gtk
pacman -S mingw-w64-x86_64-gtk4

# 语言开发包
pacman -S mingw-w64-x86_64-toolchain base-devel
  1. 重启 PowerShell 和 VSCode
  2. 在 VSCode 的 PowerShell 中运行
$Env:PATH -split ';'

PS C:\Users\df366\a\a> $Env:PATH -split ';'
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Windows\System32\OpenSSH\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
C:\Program Files\dotnet\
C:\Program Files\Docker\Docker\resources\bin
D:\Git\cmd
D:\MSYS2\mingw64\bin
D:\MSYS2\mingw64\lib
D:\MSYS2\mingw64\include
C:\Users\df366\AppData\Roaming\local\bin
C:\Users\df366\AppData\Local\Microsoft\WindowsApps
C:\Users\df366\.dotnet\tools
C:\Program Files\MongoDB\Server\7.0\bin
D:\Microsoft VS Code\bin
C:\ghcup\bin
D:\PyCharm 2023.2.2\bin

注意:这里必须重启 VSCode,否则系统环境中的变量不会更新。

  1. 检查 pkg-config
Get-Command pkg-config

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     pkg-config.exe                                     0.0.0.0    D:\MSYS2\mingw64\bin\pkg-config.exe

发现 pkg-config 已经变成 MSYS2 下的了

  1. 重新执行 stack build,运行成功
PS C:\Users\df366\a\a> stack build
a-0.1.0.0: unregistering (local file changes: app\Main.hs)
a> build (lib + exe)
Preprocessing library for a-0.1.0.0..
Building library for a-0.1.0.0..
[6 of 7] Compiling Main [Source file changed]

app\Main.hs:3:1: warning: [-Wunused-imports]
    The import of 鈥楩etch鈥?is redundant

      except perhaps to import instances from 鈥楩etch鈥?[0m

    To import instances alone, use: import Fetch()
  |
3 | import Fetch
  | ^^^^^^^^^^^^

app\Main.hs:4:1: warning: [-Wunused-imports]
    The import of 鈥楧ata.Text鈥?is redundant

      except perhaps to import instances from 鈥楧ata.Text鈥?[0m

    To import instances alone, use: import Data.Text()
  |
4 | import Data.Text (Text, splitOn)
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

app\Main.hs:5:1: warning: [-Wunused-imports]
    The qualified import of 鈥楧ata.Text鈥?is redundant

      except perhaps to import instances from 鈥楧ata.Text鈥?[0m

    To import instances alone, use: import Data.Text()
  |
5 | import qualified Data.Text as T
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

app\Main.hs:6:1: warning: [-Wunused-imports]
    The import of 鈥楧atabase鈥?is redundant

      except perhaps to import instances from 鈥楧atabase鈥?[0m

    To import instances alone, use: import Database()
  |
6 | import Database
  | ^^^^^^^^^^^^^^^
[7 of 7] Linking app\Main.exe [Objects changed]
Preprocessing executable 'a-exe' for a-0.1.0.0..
Building executable 'a-exe' for a-0.1.0.0..
[1 of 2] Compiling Main [Source file changed]

app\Main.hs:3:1: warning: [-Wunused-imports]
    The import of 鈥楩etch鈥?is redundant

      except perhaps to import instances from 鈥楩etch鈥?[0m

    To import instances alone, use: import Fetch()
  |
3 | import Fetch
  | ^^^^^^^^^^^^

app\Main.hs:4:1: warning: [-Wunused-imports]
    The import of 鈥楧ata.Text鈥?is redundant

      except perhaps to import instances from 鈥楧ata.Text鈥?[0m

    To import instances alone, use: import Data.Text()
  |
4 | import Data.Text (Text, splitOn)
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

app\Main.hs:5:1: warning: [-Wunused-imports]
    The qualified import of 鈥楧ata.Text鈥?is redundant

      except perhaps to import instances from 鈥楧ata.Text鈥?[0m

    To import instances alone, use: import Data.Text()
  |
5 | import qualified Data.Text as T
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

app\Main.hs:6:1: warning: [-Wunused-imports]
    The import of 鈥楧atabase鈥?is redundant

      except perhaps to import instances from 鈥楧atabase鈥?[0m

    To import instances alone, use: import Database()
  |
6 | import Database
  | ^^^^^^^^^^^^^^^
[3 of 3] Linking .stack-work\dist\22605e11\build\a-exe\a-exe.exe [Objects changed]
a> copy/register
Installing library in C:\Users\df366\a\a\.stack-work\install\1b692ffa\lib\x86_64-windows-ghc-9.4.7\a-0.1.0.0-5LEhwaAmmakDiuPZZmv67T
Installing executable a-exe in C:\Users\df366\a\a\.stack-work\install\1b692ffa\bin
Registering library for a-0.1.0.0..
  1. Main 代码
module Main (main) where

import Fetch
import Data.Text (Text, splitOn)
import qualified Data.Text as T
import Database
-- import Diagrams.Prelude
-- import Diagrams.Backend.SVG
-- import Diagrams.Attributes
-- import Diagrams.Backend.SVG.CmdLine

import Graphics.Rendering.Chart
import Graphics.Rendering.Chart.Backend.Cairo
import Data.Colour
import Control.Lens
import Data.Default.Class

chart :: Bool -> Renderable ()
chart borders = toRenderable layout
 where
  layout =
        layout_title .~ "Sample Bars" ++ btitle
      $ layout_title_style . font_size .~ 10
      $ layout_x_axis . laxis_generate .~ autoIndexAxis alabels
      $ layout_y_axis . laxis_override .~ axisGridHide
      $ layout_left_axis_visibility . axis_show_ticks .~ False
      $ layout_plots .~ [ plotBars bars2 ]
      $ def :: Layout PlotIndex Double

  bars2 = plot_bars_titles .~ ["Cash","Equity"]
      $ plot_bars_values .~ addIndexes [[20,45],[45,30],[30,20],[70,25]]
      $ plot_bars_style .~ BarsClustered
      $ plot_bars_spacing .~ BarsFixGap 30 5
      $ plot_bars_item_styles .~ map mkstyle (cycle defaultColorSeq)
      $ def

  alabels = [ "Jun", "Jul", "Aug", "Sep", "Oct" ]

  btitle = if borders then "" else " (no borders)"
  bstyle = if borders then Just (solidLine 1.0 $ opaque black) else Nothing
  mkstyle c = (solidFillStyle c, bstyle)

main :: IO ()
main = do
  _ <- renderableToFile def "example11_big.png" (chart True)
  return ()

-- spilitByLine :: String -> [String]
-- spilitByLine s = map T.unpack $ splitOn (T.pack "\n") (T.pack s)

-- main :: IO ()
-- main = do
--     a <- downloadURL "http://prod.publicdata.landregistry.gov.uk.s3-website-eu-west-1.amazonaws.com/pp-2022.csv"

--     let items = spilitByLine a
--     print $ length items
--     print $ head items
--     print $ items !! 1
--     print 33
--     print "3.6.2.0"
    
  1. 输出图
    在这里插入图片描述

  2. cabal 文件(无需修改,在 package.yaml 添加依赖后,运行 stack update 会同步更新)

cabal-version: 2.2

-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack

name:           a
version:        0.1.0.0
description:    Please see the README on GitHub at <https://github.com/githubuser/a#readme>
homepage:       https://github.com/githubuser/a#readme
bug-reports:    https://github.com/githubuser/a/issues
author:         Author name here
maintainer:     example@example.com
copyright:      2023 Author name here
license:        BSD-3-Clause
license-file:   LICENSE
build-type:     Simple
extra-source-files:
    README.md
    CHANGELOG.md

source-repository head
  type: git
  location: https://github.com/githubuser/a

library
  exposed-modules:
      Database
      Fetch
      Lib
      Types
      Main
  other-modules:
      Paths_a
  autogen-modules:
      Paths_a
  hs-source-dirs:
      src
      app
  ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints
  build-depends:
      Chart
    , Chart-cairo
    , aeson
    , base >=4.7 && <5
    , binary
    , binary-orphans
    , bytestring
    , colour
    , data-default-class
    , directory
    , http-conduit
    , lens
    , old-locale
    , pretty-simple
    , split
    , sqlite-simple
    , stm
    , string-conversions
    , text
    , time
  default-language: Haskell2010

executable a-exe
  main-is: Main.hs
  other-modules:
      Paths_a
  autogen-modules:
      Paths_a
  hs-source-dirs:
      app
  ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      Chart
    , Chart-cairo
    , a
    , aeson
    , base >=4.7 && <5
    , binary
    , binary-orphans
    , bytestring
    , colour
    , data-default-class
    , directory
    , lens
    , old-locale
    , pretty-simple
    , split
    , sqlite-simple
    , stm
    , string-conversions
    , text
    , time
  default-language: Haskell2010

test-suite a-test
  type: exitcode-stdio-1.0
  main-is: Spec.hs
  other-modules:
      Paths_a
  autogen-modules:
      Paths_a
  hs-source-dirs:
      test
  ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      a
    , base >=4.7 && <5
  default-language: Haskell2010

参考博客:
https://stackoverflow.com/questions/57940965/pkg-config-installed-but-not-found
https://stackoverflow.com/questions/44314060/haskell-stack-nix-build-fails-requiring-pkg-config-0-9-0-and-cairo-1
https://stackoverflow.com/questions/5336865/cant-install-cairo-with-cabal-on-windows-how-to-get-pkg-config-on-win
https://stackoverflow.com/questions/63396432/having-dependency-issues-while-trying-to-install-threadscope-with-stack-the-iss
https://github.com/commercialhaskell/stack/issues/377
https://stackoverflow.com/questions/77441659/haskell-after-install-the-conduit-package
https://zhuanlan.zhihu.com/p/623146940

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/199091.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

查看当前目录下文件数量

查看当前目录下文件数量 查看文件夹数量查看文件数查看所有文件&#xff08;包括子文件&#xff09;数量查看所有目录&#xff08;包括子目录&#xff09;数量查看图片数量 查看文件夹数量 ls -l | grep ^d | wc -l查看文件数 不包含文件夹 ls -l | grep ^- | wc -l查看所有…

Selenium 学习(0.17)——软件测试之测试用例设计方法——白盒测试——逻辑覆盖法(条件覆盖和条件判定覆盖)

条件覆盖 设计测试用例&#xff0c;使每个判断中每个条件的可能取值至少满足一次。 条件判定覆盖 通过设计足够的测试用例&#xff0c;满足如下条件&#xff1a; 所有条件的可能至少执行一次的取值 所有判断的可能结果至少执行一次 条件判定覆盖同时满足判定覆…

springcloud nacos配置优先级研究及配置管理最佳实践

目录 背景工具版本SpringCloud配置存放位置及相应优先级代码中nacosjar包外挂 多种配置共同存在时的优先级项目配置管理最佳实践无nacos的情况有nacos的情况 参考文献 背景 公司有很多应用是基于SpringBoot/SpringCloud开发。由于在配置文件中经常会涉及数据库账号密码之类的敏…

【Java学习笔记】73 - 正则表达式

项目代码 https://github.com/yinhai1114/Java_Learning_Code/tree/main/IDEA_Chapter27/src/com/yinhai/regexp 一、引入正则表达式 1.提取文章中所有的英文单词 2.提取文章中所有的数字 3.提取文章中所有的英文单词和数字 4.提取百度热榜标题 正则表达式是处理文本的利器…

【ShardingSphere专题】SpringBoot整合ShardingSphere(一、数据分片入门及实验)

目录 前言阅读对象笔记正文一、ShardingSphere介绍1.1 ShardingSphere-JDBC&#xff1a;代码级别1.2 ShardingSphere-Proxy&#xff1a;应用级别1.3 横向对比图 二、ShardingSphere之——数据分片2.1 基本介绍2.2 分片的形式2.2.1 垂直分片2.2.2 水平分片 2.3 数据分片核心概念…

JavaWeb后端数据库MySQL的使用

JavaWeb MySQLSQL数据库设计 多表设计1对多1对1多对多 多表查询连接查询内连接外连接左外连接右外连接 子查询事务索引 MySQL MySQL数据模型 关系型数据库&#xff1a;建立在关系模型基础上&#xff0c;由多张相互连接的二维表组成的数据库。 SQL SQL&#xff1a;操作关系型数…

【读论文】【泛读】S-NERF: NEURAL RADIANCE FIELDS FOR STREET VIEWS

文章目录 0. Abstract1. Introduction2. Related work3. Methods-NERF FOR STREET VIEWS3.1 CAMERA POSE PROCESSING3.2 REPRESENTATION OF STREET SCENES3.3 DEPTH SUPERVISION3.4 Loss function 4. EXPERIMENTS5. ConclusionReference 0. Abstract Problem introduction&…

井盖倾斜怎么办?智能井盖传感器监测方法

井盖倾斜是一个紧迫的问题&#xff0c;如果不及时处理可能会导致道路安全性下降&#xff0c;进而增加车辆和行人发生意外的风险。为应对这一问题现已开发出智能井盖传感器&#xff0c;它可以持续监测井盖的状态&#xff0c;一旦发现倾斜等异常情况会立即发出警报。 在智慧城市的…

前端---JavaScript篇

1. 介绍 JavaScript 是 前端开发人员必须学习的 3 门语言中的一门&#xff1a; HTML 定义了网页的内容CSS 描述了网页的布局JavaScript 控制了网页的行为 接下来开始详解JavaScript。 2.引入方法 js有两种导入方式&#xff0c;一种是内部脚本&#xff1a;直接在html页面中…

csv文件EXCEL默认打开乱码问题

这里讨论的问题是&#xff0c;当用记事本打开带有中文字符的csv正常时&#xff0c;用excel打开却是乱码。 简单概括就是&#xff1a;编码问题&#xff0c;windows的 excel打开csv文本文件时&#xff0c;默认使用的是系统内的ANSI&#xff0c;在中文环境下就是GB2312。如果写文件…

NX二次开发UF_MTX3_vec_multiply_t 函数介绍

文章作者&#xff1a;里海 来源网站&#xff1a;https://blog.csdn.net/WangPaiFeiXingYuan UF_MTX3_vec_multiply_t Defined in: uf_mtx.h void UF_MTX3_vec_multiply_t(const double vec [ 3 ] , const double mtx [ 9 ] , double vec_product [ 3 ] ) overview 概述 Ret…

C#,数值计算——插值和外推,径向基函数插值(RBF_inversemultiquadric)的计算方法与源程序

1 文本格式 using System; namespace Legalsoft.Truffer { public class RBF_inversemultiquadric : RBF_fn { private double r02 { get; set; } public RBF_inversemultiquadric(double scale 1.0) { this.r02 Globals.SQR(scale); …

nginx 配置跨域(小皮面板)

本地开发的时候&#xff0c;前端请求后端&#xff0c;后端不能用域名请求&#xff0c;只能用端口模式&#xff0c;在小皮面板的话就是如下配置&#xff1a; 我的测试项目部署&#xff1a; 前端&#xff1a;http://localhost:8082 后端&#xff1a;http://localhost:8081 前端…

【小黑嵌入式系统第十课】μC/OS-III概况——实时操作系统的特点、基本概念(内核任务中断)、与硬件的关系实现

文章目录 一、为什么要学习μC/OS-III二、嵌入式操作系统的发展历史三、实时操作系统的特点四、基本概念1. 前后台系统2. 操作系统3. 实时操作系统&#xff08;RTOS&#xff09;4. 内核5. 任务6. 任务优先级7. 任务切换8. 调度9. 非抢占式&#xff08;合作式&#xff09;内核10…

C陷阱与缺陷——第2章语法陷阱

1. 理解函数声明 硬件将调用首地址为0位置的子例程 (*(void(*)())0)(); 任何C变量的声明都由两部分组成&#xff1a;类型以及一组类似表达式的声明符&#xff0c;声明符从表面看与表达式有些类似&#xff0c;对它求值应该返回一个声明中给定类型的结果。 假定变量fp是一个函…

UData+StarRocks在京东物流的实践 | 京东物流技术团队

1 背景 数据服务与数据分析场景是数据团队在数据应用上两个大的方向&#xff0c;行业内大家有可能会遇到下面的问题&#xff1a; 1.1 数据服务 烟囱式开发模式&#xff1a;每来一个需求开发一个数据服务&#xff0c;数据服务无法复用&#xff0c;难以平台化&#xff0c;技术…

IWDG和WWDG HAL库+cubeMX

一.IWDG 1.原理 启用IWDG后&#xff0c;LSI时钟会自动开启 2.IWDG溢出时间计算 3.IWDG配置步骤 4.HAL库相关函数介绍 HAL_IWDG_Init //使能IWDG&#xff0c;设置预分频系数和重装载值等 HAL_IWDG_Refresh //把重装载寄存器的值重载到计数器中&#xff0c;喂狗typedef str…

上海数字孪生技术推进制造业升级,工业物联网可视化应用加速

上海数字孪生技术推进制造业升级&#xff0c;工业物联网可视化应用加速。数字孪生技术&#xff0c;是从数字模型、数字样机的相关技术发展而来&#xff0c;而对于生产系统的数字孪生又和虚拟制造这一相关技术。数字孪生不是全新技术&#xff0c;它具有建模仿真、虚拟制造、数字…

使用.NET8中的.http文件和终结点资源管理器

本文将以.NET8的模板增加的.http文件为引&#xff0c;介绍 Visual Studio 2022 中的 .http 文件编辑器&#xff0c;这是一个用于测试 ASP.NET Core 项目的强大工具。 文章目录 1. 背景2. HTTP 文件介绍2.1 简介2.2 .http 文件语法3. 在 Visual Studio 中使用3.1 终结点资源管理…

【RESTful API】RESTful接口设计练习

参考: BV1Ps4y1J7Ve ---------------------------------------------------------------------------------------------------------- 一、RESTful框架 常见的有SpringMVC,jersey,play 二、API测试工具 Postman,Insomnia 三、RESTful接口设计练习 3.1 项目准备 构…