matlab编程实践18、19

news2025/1/17 1:01:16

浅水方程


        浅水方程可以建立起海啸和浴缸中波浪的数学模型。浅水方程建立了水或者其它不可压缩液体受扰动时传播的模型。隐含的假设是,液体的深度和波浪的长度、扰动等相比是很小的。

         在这样的记号下,浅水方程为双曲守恒定律的一个例子。

\frac{\partial U}{\partial t}+\frac{\partial F(U)}{\partial x}+\frac{\partial G(U)}{\partial y}=0

        使用拉克斯-冯特洛夫方法计算方程的近似数值解。waterwave求解的区域为正方形区域,有反射的边界条件。在初始时刻,在整个区域都有h=1,u=0,v=0,这样解是静态的。然后在连续几个时间步长内,二维高斯型峰值添加到h处,用来模拟水滴滴到水面上的冲量扰动作用。

shading 设置颜色着色属性

function waterwave
% WATERWAVE   2D Shallow Water Model
%
% Lax-Wendroff finite difference method.
% Reflective boundary conditions.
% Random water drops initiate gravity waves.
% Surface plot displays height colored by momentum.
% Plot title shows t = simulated time and tv = a measure of total variation.
%t = 模拟时间,tv = 总变化量
% An exact solution to the conservation law would have constant tv.
% Lax-Wendroff produces nonphysical oscillations and increasing tv.
%
% See:
%    http://en.wikipedia.org/wiki/Shallow_water_equations
%    http://www.amath.washington.edu/~rjl/research/tsunamis
%    http://www.amath.washington.edu/~dgeorge/tsunamimodeling.html
%    http://www.amath.washington.edu/~claw/applications/shallow/www

% Parameters

n = 64;                  % grid size
g = 9.8;                 % gravitational constant
dt = 0.01;               % hardwired timestep
dx = 1.0;
dy = 1.0;
nplotstep = 8; %绘图间隔
ndrops = 1; % 最大滴数
dropstep = 200; % 液滴间隔
D = droplet(1.5,21); % 模拟水滴
% Initialize graphics

[surfplot,top,restart,quit] = initgraphics(n); %启动图形

% Outer loop, restarts.

while get(quit,'value') == 0
   set(restart,'value',0)
   
   H = ones(n+2,n+2);   U = zeros(n+2,n+2);  V = zeros(n+2,n+2);
   Hx = zeros(n+1,n+1); Ux = zeros(n+1,n+1); Vx = zeros(n+1,n+1);
   Hy = zeros(n+1,n+1); Uy = zeros(n+1,n+1); Vy = zeros(n+1,n+1);
   ndrop = ceil(rand*ndrops);
   nstep = 0;

   % Inner loop, time steps.

   while get(restart,'value')==0 && get(quit,'value')==0
       nstep = nstep + 1;

       % Random water drops
       if mod(nstep,dropstep) == 0 && nstep <= ndrop*dropstep
           w = size(D,1);
           i = ceil(rand*(n-w))+(1:w);
           j = ceil(rand*(n-w))+(1:w);
           H(i,j) = H(i,j) + (1+4*rand)/5*D;
       end
     
       % Reflective boundary conditions
       H(:,1) = H(:,2);      U(:,1) = U(:,2);       V(:,1) = -V(:,2);
       H(:,n+2) = H(:,n+1);  U(:,n+2) = U(:,n+1);   V(:,n+2) = -V(:,n+1);
       H(1,:) = H(2,:);      U(1,:) = -U(2,:);      V(1,:) = V(2,:);
       H(n+2,:) = H(n+1,:);  U(n+2,:) = -U(n+1,:);  V(n+2,:) = V(n+1,:);

       % First half step
   
       % x direction
       i = 1:n+1;
       j = 1:n;
   
       % height
       Hx(i,j) = (H(i+1,j+1)+H(i,j+1))/2 - dt/(2*dx)*(U(i+1,j+1)-U(i,j+1));
   
       % x momentum
       Ux(i,j) = (U(i+1,j+1)+U(i,j+1))/2 -  ...
                 dt/(2*dx)*((U(i+1,j+1).^2./H(i+1,j+1) + g/2*H(i+1,j+1).^2) - ...
                            (U(i,j+1).^2./H(i,j+1) + g/2*H(i,j+1).^2));
   
       % y momentum
       Vx(i,j) = (V(i+1,j+1)+V(i,j+1))/2 - ...
                 dt/(2*dx)*((U(i+1,j+1).*V(i+1,j+1)./H(i+1,j+1)) - ...
                            (U(i,j+1).*V(i,j+1)./H(i,j+1)));
       
       % y direction
       i = 1:n;
       j = 1:n+1;
   
       % height
       Hy(i,j) = (H(i+1,j+1)+H(i+1,j))/2 - dt/(2*dy)*(V(i+1,j+1)-V(i+1,j));
   
       % x momentum
       Uy(i,j) = (U(i+1,j+1)+U(i+1,j))/2 - ...
                 dt/(2*dy)*((V(i+1,j+1).*U(i+1,j+1)./H(i+1,j+1)) - ...
                            (V(i+1,j).*U(i+1,j)./H(i+1,j)));
       % y momentum
       Vy(i,j) = (V(i+1,j+1)+V(i+1,j))/2 - ...
                 dt/(2*dy)*((V(i+1,j+1).^2./H(i+1,j+1) + g/2*H(i+1,j+1).^2) - ...
                            (V(i+1,j).^2./H(i+1,j) + g/2*H(i+1,j).^2));
   
       % Second half step
       i = 2:n+1;
       j = 2:n+1;
   
       % height
       H(i,j) = H(i,j) - (dt/dx)*(Ux(i,j-1)-Ux(i-1,j-1)) - ...
                         (dt/dy)*(Vy(i-1,j)-Vy(i-1,j-1));
       % x momentum
       U(i,j) = U(i,j) - (dt/dx)*((Ux(i,j-1).^2./Hx(i,j-1) + g/2*Hx(i,j-1).^2) - ...
                         (Ux(i-1,j-1).^2./Hx(i-1,j-1) + g/2*Hx(i-1,j-1).^2)) ...
                       - (dt/dy)*((Vy(i-1,j).*Uy(i-1,j)./Hy(i-1,j)) - ...
                         (Vy(i-1,j-1).*Uy(i-1,j-1)./Hy(i-1,j-1)));
       % y momentum
       V(i,j) = V(i,j) - (dt/dx)*((Ux(i,j-1).*Vx(i,j-1)./Hx(i,j-1)) - ...
                         (Ux(i-1,j-1).*Vx(i-1,j-1)./Hx(i-1,j-1))) ...
                       - (dt/dy)*((Vy(i-1,j).^2./Hy(i-1,j) + g/2*Hy(i-1,j).^2) - ...
                         (Vy(i-1,j-1).^2./Hy(i-1,j-1) + g/2*Hy(i-1,j-1).^2));
   
       % Update plot
       if mod(nstep,nplotstep) == 0
          C = abs(U(i,j)) + abs(V(i,j));  % Color shows momemtum
          t = nstep*dt;
          tv = norm(C,'fro');
          set(surfplot,'zdata',H(i,j),'cdata',C);
          set(top,'string',sprintf('t = %6.2f,  tv = %6.2f',t,tv))
          drawnow
       end
      
       if all(all(isnan(H))), break, end  % Unstable, restart
   end
end
close(gcf)

% ------------------------------------

function D = droplet(height,width)
% DROPLET  2D Gaussian
% D = droplet(height,width)
   [x,y] = ndgrid(-1:(2/(width-1)):1);
   D = height*exp(-5*(x.^2+y.^2));

% ------------------------------------

function [surfplot,top,restart,quit] = initgraphics(n);
% INITGRAPHICS  Initialize graphics for waterwave.
% [surfplot,top,restart,quit] = initgraphics(n)
% returns handles to a surface plot, its title, and two uicontrol toggles.

   clf
   shg
   set(gcf,'numbertitle','off','name','Shallow_water')
   x = (0:n-1)/(n-1);
   surfplot = surf(x,x,ones(n,n),zeros(n,n));
   grid off
   axis([0 1 0 1 -1 3])
   caxis([-1 1])
   shading faceted
   c = (1:64)'/64;
   cyan = [0*c c c];
   colormap(cyan)
   top = title('xxx');
   restart = uicontrol('position',[20 20 80 20],'style','toggle','string','restart');
   quit = uicontrol('position',[120 20 80 20],'style','toggle','string','close');


摩尔斯电码


        摩尔斯电码演示了二元树(binary tree)单元数组(cell array)。电码由短的点(dot或‘.’)或者长的停顿(dash或‘-’)分隔。

        '...---...'表示SOS,‘...--...’表示SMS。


摩尔斯树


        采用二元树来定义摩尔斯电码。从根节点开始向左移动一个链接表示一个“点”,向右表示一个“划”。如可以用“.-”来表示字母A。

 

function M = morse_tree
% MORSE_TREE
% M = morse_tree is a cell array of cell arrays, the binary
% tree for the Morse code of the 26 Latin characters.
%
% M = morse_tree_extended is a larger cell array of cell arrays,
% the binary tree for the Morse code of the 26 Latin characters
% plus digits, punctuation marks, and several non-Latin characters.
%
%                     _____  root _____
%                   /                   \
%               _ E _                   _ T _
%            /         \             /         \
%           I           A           N           M
%         /   \       /   \       /   \       /   \
%        S     U     R     W     D     K     G     O
%       / \   /     /     / \   / \   / \   / \
%      H   V F     L     P   J B   X C   Y Z   Q
%

global extend
if extend==1
   M = morse_tree_extended;
   return
end

% Level 4
h = {'H' {} {}};
v = {'V' {} {}};
f = {'F' {} {}};
l = {'L' {} {}};
p = {'P' {} {}};
j = {'J' {} {}};
b = {'B' {} {}};
x = {'X' {} {}};
c = {'C' {} {}};
y = {'Y' {} {}};
z = {'Z' {} {}};
q = {'Q' {} {}};

% Level 3
s = {'S' h v};
u = {'U' f {}};
r = {'R' l {}};
w = {'W' p j};
d = {'D' b x};
k = {'K' c y};
g = {'G' z q};
o = {'O' {} {}};

% Level 2
i = {'I' s u};
a = {'A' r w};
n = {'N' d k};
m = {'M' g o};

% Level 1
e = {'E' i a};
t = {'T' n m};

% Level 0
M = {'' e t};

树的搜索


        反复选择树上的不同分支对应着遍历这个树的不同顺序。在众多可能的排序中,有两种有着标准的名字:深度优先搜索方法(depth-first search)广度优先搜索(breadth-first search)

         深度优先的方法使用的是成为栈(stack)的数据结构。栈S为单元数组,只要栈是非空的,while循环就一直进行下去。

   S = {morse_tree};
   while ~isempty(S)
      N = S{1};
      S = S(2:end);
      if ~isempty(N)
         fprintf(' %s',N{1})
         S = {N{2} N{3} S{:}};
      end
   end
   fprintf('\n')

        广度优先搜索算法用了称为队列(queue)的数据结构。

%% Breadth first, with a queue.
   Q = {morse_tree};
   while ~isempty(Q)
      N = Q{1};
      Q = Q(2:end);
      if ~isempty(N)
         fprintf(' %s',N{1})
         Q = {Q{:} N{2} N{3}};
      end
   end
   fprintf('\n')

        队列采用了先进先出(FIFO)的策略,而堆栈采用了后进先出(LIFO)的策略。

function morse_gui(arg)
% MORSE_GUI  Interactive demonstration of Morse code and binary trees.

   if nargin == 0
      init_gui
   elseif isequal(arg,'_depth')
      depth
   elseif isequal(arg,'_breadth') 
      breadth
   else
      translate
   end

   % ------------------------------------
   
   function depth
      % Depth first traversal of Morse code binary tree
      % Stack, LIFO, last in first out.
      % Insert new items at the top of the stack.
      S = {morse_tree};
      X = 0;
      Y = 0;
      while ~isempty(S)
         N = S{1};
         S = S(2:end);
         x = X(1);
         X = X(2:end);
         y = Y(1);
         Y = Y(2:end);
         if ~isempty(N)
            node(N{1},x,y)
            S = {N{2} N{3} S{:}};
            X = [2*x-(x>=0); 2*x+(x<=0); X];
            Y = [y+1; y+1; Y];
         end
      end
   end % depth

   % ------------------------------------
   
   function breadth
      % Breadth first traversal of Morse code binary tree.
      % Queue, FIFO, first in first out.
      % Insert new items at the end of the queue.
      Q = {morse_tree};
      X = 0;
      Y = 0;
      while ~isempty(Q)
         N = Q{1};
         Q = Q(2:end);
         x = X(1);
         X = X(2:end);
         y = Y(1);
         Y = Y(2:end);
         if ~isempty(N)
            node(N{1},x,y);
            Q = {Q{:} N{2} N{3}};
            X = [X; 2*x-(x>=0); 2*x+(x<=0)];
            Y = [Y; y+1; y+1];
         end
      end
   end % breadth

   % ------------------------------------
   
   function translate
      % Translate to and from Morse code.
      e = findobj('style','edit');
      s = findobj('string','sound');
      t = get(e,'string');
      if all(t=='.' | t=='-' | t==' ' | t=='*')
         t = decode(t);
         set(e,'string',t);
      else
         code = encode(t);
         set(e,'string',code);
         if get(s,'value') == 1
            morse_sound(code)
         end
      end
      if length(t)>=3 && isequal(t(1:3),'SOS')
         scream
      end
   end

   % ------------------------------------

   function code = encode(text)
      % ENCODE  Translate text to dots and dashes.
      % encode('text')
   
      code = '';
      text = upper(text);
      for k = 1:length(text);
         ch = text(k);
         % A blank in the text is worth three in the code.
         if ch == ' '
            code = [code '   '];
         else
            code = [code encode_ch(ch) ' '];
         end
      end
   
   end % encode

   % ------------------------------------

   function dd = encode_ch(ch)
      % ENCODE_CH  Translate one character to dots and dashes.
   
      S = {morse_tree};
      D = {''};
      while ~isempty(S)
         N = S{1};
         dd = D{1};
         S = S(2:end);
         D = D(2:end);
         if ~isempty(N)
            if N{1} == ch;
               return
            else
               S = {N{2} N{3} S{:}};
               D = {[dd '.'] [dd '-'] D{:}};
            end
         end
      end
      dd = '*';
   
   end % encode_ch

   % ------------------------------------

   function text = decode(code)
      % DECODE  Translate strings of dots and dashes to text.
      % decode('string of dots, dashes and spaces')
   
      text = [];
      code = [code ' '];
      while ~isempty(code);
         k = find(code == ' ',1);
         ch = decode_dd(code(1:k));
         text = [text ch];
         code(1:k) = [];
         % Many blanks in the code is worth one in the text.
         if ~isempty(code) && code(1) == ' '
            text = [text ' '];
            while ~isempty(code) && code(1) == ' '
               code(1) = [];
            end
         end
      end
   
   end % decode

   % ------------------------------------

   function ch = decode_dd(dd)
      % DECODE_DD  Translate one character's worth of dots
      % and dashes to a single character of text.

      M = morse_tree;
      for k = 1:length(dd)
         if dd(k) == '.'
            M = M{2};
         elseif dd(k) == '-'
            M = M{3};
         end
         if isempty(M)
            ch = '*';
            return
         end
      end
      ch = M{1};
   
   end % decode_dd

   % ------------------------------------

   function init_gui
      % Initialize Morse code gui.
      global extend
      extend = 0;
      clf reset
      axes('pos',[0 0 1 1])
      axis(16*[-1 1 0 2])
      axis square off
      set(gcf,'color','white')
      set(gca,'ydir','rev')
      uicontrol('style','push','string','depth', ...
         'units','normal','pos',[0.16 0.20 0.12 0.06], ...
         'callback','cla, morse_gui(''_depth'')')
      uicontrol('style','push','string','breadth', ...
         'units','normal','pos',[0.35 0.20 0.12 0.06], ...
         'callback','cla, morse_gui(''_breadth'')')
      uicontrol('style','toggle','string','sound','value',1, ...
         'units','normal','pos',[0.54 0.20 0.12 0.06]);
      uicontrol('style','toggle','string','extend','value',0, ...
         'units','normal','pos',[0.72 0.20 0.12 0.06], ...
         'callback', ['global extend, extend=get(gcbo,''value'');' ...
         'if extend==0, cla, end, axis(2^(4+extend)*[-1 1 0 2])']);
      uicontrol('style','edit','string', ...
         'Enter text or code to translate', ...
         'units','normal','pos',[0.16 0.04 0.68 0.08], ...
         'callback','cla, morse_gui(''_translate'')')
   end

   % ------------------------------------

   function node(ch,x,y)
      % Plot, and possibly play, node of Morse code binary tree.
      global extend
      r = 0.90;
      z = r*exp(2*pi*i*(0:32)/32);
      delta = 1/3;
      dkgreen = [0 1/2 0];
      lw = get(0,'defaultlinelinewidth')+0.5;
      fs = get(0,'defaulttextfontsize');
      if ~extend
         lw = lw+1;
         fs = fs+2;
      end
      p = 2^(4+extend-y);
      u = (x~=0)*(2*x+2*(x<=0)-1)*p;
      v = 4*(y+1);
      % Circle
      line(u+real(z),v+imag(z),'color','black','linewidth',lw)
      % Character
      text(u-delta,v,ch,'fontweight','bold','color',dkgreen,'fontsize',fs);
      % Connect node to parent
      if (x~=0)
         if y==1
            w = 0;
         elseif rem(x,2)==(x>0)
            w = u+p;
         else
            w = u-p;
         end
         line([u w],[v-r v+r-4],'color','black','linewidth',lw)
      end
      if get(findobj('string','sound'),'value') == 1
         morse_sound(encode_ch(ch))
         pause(0.2)
      end
      pause(0.1)
   end

   % ------------------------------------

   function morse_sound(code,delta,note)
      % MORSE_SOUND  Play sound for dots and dashes.
      % morse_sound(code) plays code, a string of dots, dashes and spaces.
      % morse_sound(code,delta,note) time slice is delta and tone is note.
      % Default delta = 1/16 second.
      % Default note = 6, which is F above middle C.  See play_note.
      
      if nargin < 2
         delta = 1/16;
      end
      if nargin < 3
         note = 6;
      end
      s = findobj('string','sound');
      for k = 1:length(code)
         if get(s,'value') == 1
            switch code(k)
               case '.'
                  play_note(note,delta)
               case '-'
                  play_note(note,3*delta)
               case ' '
                  pause(3*delta)
               otherwise
                  % Skip the character
            end
            pause(delta)
         end
      end
   end  % morse_sound

   % ------------------------------------

   function play_note(note,T)
      % PLAY_NOTE  Play a musical note.
      % play_note(note,T)  Play a note for T seconds.
      % note is an integer specifying semitones above and below middle C.
      % There are 12 notes per octave.
      % play_note(0,1/2) plays middle C (~261.625 Hz) for 1/2 second.
   
      C4 = 440/2^(3/4);             % Middle C, hertz
      Fs = 44100;                   % Sample rate, hertz
      t = (0:1/Fs:T);               % Linear time ramp
      f = C4 * 2^(note/12);         % Frequency, hertz
      y = sin(2*pi*f*t);            % Sinusoidal signal
      k = 1:1000;                   % Attack and release
      r = (k/1000);
      y(k) = r.*y(k);
      y(end+1-k) = r.*y(end+1-k);
      sound(y,Fs)                   % Play
   end  % play_note

end % morse_gui

解码和编码


        解码是将 “点和划” 描述的东西变成文字;编码过程正好反过来。

   function text = decode(code)
      % DECODE  Translate strings of dots and dashes to text.
      % decode('string of dots, dashes and spaces')
   
      text = [];
      code = [code ' '];
      while ~isempty(code);
         k = find(code == ' ',1);
         ch = decode_dd(code(1:k));
         text = [text ch];
         code(1:k) = [];
         % Many blanks in the code is worth one in the text.
         if ~isempty(code) && code(1) == ' '
            text = [text ' '];
            while ~isempty(code) && code(1) == ' '
               code(1) = [];
            end
         end
      end
   
   end % decode
 function dd = encode_ch(ch)
      % ENCODE_CH  Translate one character to dots and dashes.
   
      S = {morse_tree};
      D = {''};
      while ~isempty(S)
         N = S{1};
         dd = D{1};
         S = S(2:end);
         D = D(2:end);
         if ~isempty(N)
            if N{1} == ch;
               return
            else
               S = {N{2} N{3} S{:}};
               D = {[dd '.'] [dd '-'] D{:}};
            end
         end
      end
      dd = '*';
   
   end % encode_ch

摩尔斯电码表


        morse_code使用了递归算法函数traverse,这种递归调用的结果把C表格和含有“点”和“划”的dd字符串合并。在matlab中,可以使用char函数将数字转换成字母,如char(65)命令转换为A。

function C = morse_code(C,M,dd) 
% MORSE_CODE
% C = morse_code
% C = morse_code(morse_tree)
% C = morse_code(morse_tree_extended)
% Generate tables of the ASCII and Morse codes
% for the characters defined by the binary trees.

   if nargin < 3           % Choose binary tree
      if nargin == 0
         M = morse_tree;
      else
         M = C;
      end
      C = cell(256,1);     % The temporary code table
      dd = '';             % dots and dashes
   end
   
   if ~isempty(M)                        % Depth first search
      if ~isempty(M{1})
         C{double(M{1})} = dd;           % Use ASCII value as an index
      end
      C = morse_code(C,M{2},[dd '.']);   % Recursive call
      C = morse_code(C,M{3},[dd '-']);   % Recursive call
   end

   if nargin < 3                    % Final processing, convert to char.
      c = char(C{:});
      k = find(c(:,1) ~= ' ');      % Find the nonblank entries.
      b = blanks(length(k))';
      C = [char(k) b b int2str(k) b b char(C{k})];
   end

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

0基础学习VR全景平台篇 第77篇:全景相机-圆周率外接收音方案

一、相机外接收音准备工作 需要自行购买USB外置声卡&#xff0c;无线麦克风&#xff0c; Type-c的拓展器。 USB外置声卡 &#xff1a; 产品参数 品牌: HAGiBiS/海备思 名称: USB三合一声卡 接口:耳麦孔/耳机孔/麦克风孔 工作电流:≤38mA 工作电压: DV 5V 输入信噪比:≥90dB …

Facebook营销推广怎么做?有哪些技巧?

Facebook是使用人数比较多的一个社交软件,也是跨境电商的首要选择平台。要想做好Facebook宣传推广&#xff0c;做好以下步骤很重要。 一、基础设置 1.创建 Facebook 业务公共主页 这相当于商业版的Facebook个人资料。您可以添加自己的品牌名称&#xff0c;上传个人资料和封面…

K8s工作原理

K8s title: Kubernetes之初探 subtitle: K8s的工作原理 date: 2018-09-18 18:26:37K8s概述 我清晰地记得曾经读到过的一篇博文&#xff0c;上面是这样写的&#xff0c; “云端教父AWS云端架构策略副总裁Adrian Cockcroft曾指出&#xff0c;两者虽然都是运用容器技术&#xff0…

“窗口期”开启!多域融合大趋势下,中国智能汽车OS如何破局?

操作系统已经成为了各大车厂、互联网企业的必争之地。 过去几年&#xff0c;丰田、大众、奔驰等众多车企&#xff0c;以及阿里、百度、腾讯、华为等纷纷加大了操作系统的布局&#xff0c;智能汽车操作系统的抢位战已经火热开启。 汽车电子电气架构已经迈入了域集中式架构、多…

国产GOWIN实现低成本实现CSI MIPI转换DVP

CSI MIPI转换DVP&#xff0c;要么就是通用IC操作&#xff0c;如龙讯芯片和索尼芯片&#xff0c;但是复杂的寄存器控制器实在开发太累。对于FPGA操作&#xff0c;大部分都是用xilinx的方案&#xff0c;xilinx方案成本太高&#xff0c;IP复杂。 而用国产GOWIN已经实现了直接mipi …

工作日报怎么写?聪明灵犀工具能帮你

工作日报怎么写&#xff1f;在工作中每天写日报是必不可少的&#xff0c;日报不仅可以记录每天的工作内容&#xff0c;也可以帮助自己更好的规划下一步的工作任务。但是&#xff0c;如何写出一份好的日报呢&#xff1f;今天我们就来介绍一些工具&#xff0c;让你的写日报更加高…

Vue3徽标数(Badge)

APIs 参数说明类型默认值必传color自定义小圆点的颜色string‘’falsecount展示的数字&#xff0c;大于 overflowCount 时显示为 overflowCount&#xff0c;为 0 时隐藏number | slot0falseoverflowCount展示封顶的数字值number99falseshowZero当数值为 0 时&#xff0c;是否展…

干货 | 清华大学叶晓俊:GB/T 35274-2023《信息安全技术 大数据服务安全能力要求》解读...

全国信息技术安全标准化委员会&#xff08;简称信安标委或TC260&#xff09;在2021年通过了编制组申请的GB/T 35274-2017《信息安全技术 大数据服务安全能力要求》修订项目&#xff0c; 新版标准报批稿在2022年年底提交给国标委进行最后的形式化审查&#xff0c;从国标委标准进…

TCP的三次握手和四次挥手······详解

1、三次握手 三次握手是建立连接的过程 如图大致为三次握手的流程图&#xff1a; 当客户端对服务端发起连接时&#xff0c;会先发一个包连接请求数据&#xff0c;去询问能否建立连接&#xff0c;该数据包称为 “SYN”包 然后&#xff0c;如果对方同意连接&#xff0c;那么…

思科单臂路由、lacp链路聚合、NAT实验

实验拓扑图&#xff1a; 实验目的&#xff1a; 如图所示配置相应IP地址和VLAN&#xff0c;并通过在AR1上配置单臂路由&#xff0c;实现VLAN10和VLAN20的主机能够在VLAN间通信&#xff1b;在SW1和SW2的三条链路实施链路聚合&#xff0c;使用静态LACP模式&#xff0c;使一条链…

【linux--->网络层协议】

文章目录 [TOC](文章目录) 一、概念1.网络层概念2.IP地址概念 二、IP协议报文结构1.首部长度2.总长度(total length)3.协议4.版本号(version)5.服务类型(Type Of Service)6.生存时间间(Time To Live, TTL) 三、网段划分1.5类IP划分法.2.CIDR(Classless Interdomain Routing)划分…

STM32刷Micropython固件参考指南

STM32刷Micropython固件指南 其实刷固件和普通的程序下载烧录无多大的差异&#xff0c;主要是其他因数的影响导致刷固件或刷完固件无法运行的情况和相关问题。 &#x1f4d1;刷固件教程 固件下载。目前所支持的stm32型号有这些&#xff1a; stm32f0, stm32f4, stm32f7, stm32g…

《零基础入门学习Python》第076讲:GUI的终极选择:Tkinter13

这节课我们来学习 Tkinter 的布局管理器&#xff0c;那什么是布局管理器呢&#xff1f;说白了&#xff0c;就是用于管理你的组件如何排列。Tkinter 提供了 3 大布局管理器&#xff1a;pack、grid 和 place。 pack 是按添加顺序排列组件grid 是按行/列形式排列组件place 则允许…

qt富文本编辑基本知识(QTextBlockFormat、QTextListFormat)

可以参考该文章&#xff1a;QTextBlockFormat、QTextListFormat - 程序员大本营 核心知识如下&#xff1a; 如果想开发一个富文本编辑器&#xff08;html&#xff0c;markdown等常见格式&#xff09;&#xff0c;Qt已经为用户完成了几乎所有与编辑有关的具体工作&#xff0c;…

工厂模式(FactoryPattern)

工厂模式 工厂模式&#xff08;Factory Pattern&#xff09;是 Java 中最常用的设计模式之一。这种类型的设计模式属于创建型模式&#xff0c;它提供了一种创建对象的最佳方式。 工厂模式提供了一种将对象的实例化过程封装在工厂类中的方式。通过使用工厂模式&#xff0c;可以…

Java:JDK8之后新的时间(推荐使用) ZoneId、 Instant、DataTimeFormatter、Period的相关API

ZoneId //目标:了解时区和带时区的时间。 //1、ZoneId的常见方法: // public static ZoneId systemDefault():获取系统默认的时区 zoneId zoneId ZoneId.systemDefault(); system.out.println(zoneId.getId()); system.out.println(zoneId);// public static Set<String>…

SOME/IP学习笔记1

SOA概念 在SOA中,每个服务就好像我们每一个人在社会中扮演的角色,在对别人提供着服务的同时,同时也享受着别人提供出来的服务,人与人之间,既是彼此独立的,又是需要互相通讯的。服务提供者将功能具象为一组接口,这样使用者就能知道如何调用服务,完成某件事情,得到某个…

亚马逊引流方式有哪些

亚马逊引流是指将潜在的买家从其他渠道引导到亚马逊平台上购买产品。以下是一些常见的亚马逊引流方式&#xff1a; 1、社交媒体营销&#xff1a;通过社交媒体平台如Facebook、Instagram、Twitter等发布有关你产品的信息、广告和优惠活动。吸引潜在客户点击链接&#xff0c;直接…

第七章 递归组件(树组件为例)

递归组件 封装树组件 App.vue <template><div class"App">App<MyTree :dataList"dataList"></MyTree></div> </template><script setup lang"ts"> import { ref, reactive } from "vue"…

Java当中更改源码/修复CVE-2016-1000027漏洞分析

Java当中更改源码/修复CVE-2016-1000027漏洞分析 文章目录 Java当中更改源码/修复CVE-2016-1000027漏洞分析1.基础知识&#xff1a;2.漏洞成因&#xff1a;3.解决方法:4.修改源码: 1.基础知识&#xff1a; ​ 要想分析首先要了解什么是Spring HTTP Invoker&#xff0c;HttpInv…