flutter聊天界面-TextField输入框实现@功能等匹配正则表达式展示高亮功能

news2024/10/5 22:15:54

flutter聊天界面-TextField输入框实现@功能等匹配正则表达式展示高亮功能

一、简要描述

描述:
最近有位朋友讨论的时候,提到了输入框的高亮展示。在flutter TextField中需要插入特殊样式的标签,比如:“请 @张三 回答一下”,这一串字符在TextField中输入,当输入@时 弹出好友列表选择,然后将 “@张三”高亮显示在TextField中。

效果图如下

在这里插入图片描述
视频效果

昨天整理的文中,简单实用TextEditingController的buildTextSpan时候,直接修改代码

List<InlineSpan> textSpans = RichTextHelper.getRichText(value.text);
    if (composingRegionOutOfRange) {
      return TextSpan(style: style, children: textSpans);
    }

会出现光标输入的问题,这里修改了一下,完善了一下。

大家可以使用rich_text_controller来实现,查看rich_text_controller源码可以看到,RichTextController继承TextEditingController,重写了buildTextSpan。经过我在iPhone上测试,当输入@汉字的时候,对中文兼容会有问题,这里做一下修改完善修改。

二、TextEditingController的buildTextSpan方法

在TextEditingController中buildTextSpan方法中,我们可以看到,该方法中的代码
在这里插入图片描述

composingRegionOutOfRange:仅有输入完成的字

在最后一部分的代码中含有未输入完成的字

final TextStyle composingStyle = style?.merge(const TextStyle(decoration: TextDecoration.underline))
        ?? const TextStyle(decoration: TextDecoration.underline);
    return TextSpan(
      style: style,
      children: <TextSpan>[
        TextSpan(text: value.composing.textBefore(value.text)),
        TextSpan(
          style: composingStyle,
          text: value.composing.textInside(value.text),
        ),
        TextSpan(text: value.composing.textAfter(value.text)),
      ],
    );
  • composingStyle未输入完成的字的样式,可以自己做下修改。

  • value.composing.textBefore:当前输入前面的字。

  • value.composing.textAfter:当前输入后面的字。

当输入过程中,我们将value.composing.textBefore,value.composing.textAfter匹配高亮即可

代码如下

value.composing.textBefore

TextSpan(style: style, children: buildRegExpSpan(context: context, text: value.composing.textBefore(value.text))),

value.composing.textAfter

TextSpan(style: style, children: buildRegExpSpan(context: context, text: value.composing.textAfter(value.text))),

匹配正则表达式

List<TextSpan> buildRegExpSpan(
      {required BuildContext context,
        TextStyle? style,
        required String? text}) {
    List<TextSpan> children = [];
    if (!(text != null && text.isNotEmpty)) {
      return children;
    }
    final matches = <String>{};
    List<Map<String, List<int>>> matchIndex = [];

    // Validating with REGEX
    RegExp? allRegex;
    allRegex = patternMatchMap != null
        ? RegExp(patternMatchMap?.keys.map((e) => e.pattern).join('|') ?? "",
        caseSensitive: regExpCaseSensitive,
        dotAll: regExpDotAll,
        multiLine: regExpMultiLine,
        unicode: regExpUnicode)
        : null;
    // Validating with Strings
    RegExp? stringRegex;
    stringRegex = stringMatchMap != null
        ? RegExp(r'\b' + stringMatchMap!.keys.join('|').toString() + r'+\$',
        caseSensitive: regExpCaseSensitive,
        dotAll: regExpDotAll,
        multiLine: regExpMultiLine,
        unicode: regExpUnicode)
        : null;
    
    text.splitMapJoin(
      stringMatchMap == null ? allRegex! : stringRegex!,
      onNonMatch: (String span) {
        if (stringMatchMap != null &&
            children.isNotEmpty &&
            stringMatchMap!.keys.contains("${children.last.text}$span")) {
          final String? ks =
          stringMatchMap!["${children.last.text}$span"] != null
              ? stringMatchMap?.entries.lastWhere((element) {
            return element.key
                .allMatches("${children.last.text}$span")
                .isNotEmpty;
          }).key
              : '';

          children.add(TextSpan(text: span, style: stringMatchMap![ks!]));
          return span.toString();
        } else {
          children.add(TextSpan(text: span, style: style));
          return span.toString();
        }
      },
      onMatch: (Match m) {
        matches.add(m[0]!);
        final RegExp? k = patternMatchMap?.entries.firstWhere((element) {
          return element.key.allMatches(m[0]!).isNotEmpty;
        }).key;

        final String? ks = stringMatchMap?[m[0]] != null
            ? stringMatchMap?.entries.firstWhere((element) {
          return element.key.allMatches(m[0]!).isNotEmpty;
        }).key
            : '';
        if (deleteOnBack!) {
          if ((isBack(text!, _lastValue) && m.end == selection.baseOffset)) {
            WidgetsBinding.instance.addPostFrameCallback((_) {
              children.removeWhere((element) => element.text! == text);
              text = text!.replaceRange(m.start, m.end, "");
              selection = selection.copyWith(
                baseOffset: m.end - (m.end - m.start),
                extentOffset: m.end - (m.end - m.start),
              );
            });
          } else {
            children.add(
              TextSpan(
                text: m[0],
                style: stringMatchMap == null
                    ? patternMatchMap![k]
                    : stringMatchMap![ks],
              ),
            );
          }
        } else {
          children.add(
            TextSpan(
              text: m[0],
              style: stringMatchMap == null
                  ? patternMatchMap![k]
                  : stringMatchMap![ks],
            ),
          );
        }
        final resultMatchIndex = matchValueIndex(m);
        if (resultMatchIndex != null && onMatchIndex != null) {
          matchIndex.add(resultMatchIndex);
          onMatchIndex!(matchIndex);
        }

        return (onMatch(List<String>.unmodifiable(matches)) ?? '');
      },
    );
    return children;
  }

这里使用的是rich_text_controller中的代码,做了相应的修改,输入@张三正则表达式正常高亮显示了。

整个text_field_controller代码如下

import 'package:flutter/material.dart';

class TextFieldController extends TextEditingController {
  final Map<RegExp, TextStyle>? patternMatchMap;
  final Map<String, TextStyle>? stringMatchMap;
  final Function(List<String> match) onMatch;
  final Function(List<Map<String, List<int>>>)? onMatchIndex;
  final bool? deleteOnBack;
  String _lastValue = "";

  /// controls the caseSensitive property of the full [RegExp] used to pattern match
  final bool regExpCaseSensitive;

  /// controls the dotAll property of the full [RegExp] used to pattern match
  final bool regExpDotAll;

  /// controls the multiLine property of the full [RegExp] used to pattern match
  final bool regExpMultiLine;

  /// controls the unicode property of the full [RegExp] used to pattern match
  final bool regExpUnicode;

  bool isBack(String current, String last) {
    return current.length < last.length;
  }

  TextFieldController(
      {String? text,
        this.patternMatchMap,
        this.stringMatchMap,
        required this.onMatch,
        this.onMatchIndex,
        this.deleteOnBack = false,
        this.regExpCaseSensitive = true,
        this.regExpDotAll = false,
        this.regExpMultiLine = false,
        this.regExpUnicode = false})
      : assert((patternMatchMap != null && stringMatchMap == null) ||
      (patternMatchMap == null && stringMatchMap != null)),
        super(text: text);

  /// Setting this will notify all the listeners of this [TextEditingController]
  /// that they need to update (it calls [notifyListeners]).
  
  set text(String newText) {
    value = value.copyWith(
      text: newText,
      selection: const TextSelection.collapsed(offset: -1),
      composing: TextRange.empty,
    );
  }

  /// Builds [TextSpan] from current editing value.
  
  TextSpan buildTextSpan(
      {required BuildContext context,
        TextStyle? style,
        required bool withComposing}) {
    assert(!value.composing.isValid || !withComposing || value.isComposingRangeValid);
    // If the composing range is out of range for the current text, ignore it to
    // preserve the tree integrity, otherwise in release mode a RangeError will
    // be thrown and this EditableText will be built with a broken subtree.
    final bool composingRegionOutOfRange = !value.isComposingRangeValid || !withComposing;

    if (composingRegionOutOfRange) {
      List<TextSpan> children = [];
      final matches = <String>{};
      List<Map<String, List<int>>> matchIndex = [];

      // Validating with REGEX
      RegExp? allRegex;
      allRegex = patternMatchMap != null
          ? RegExp(patternMatchMap?.keys.map((e) => e.pattern).join('|') ?? "",
          caseSensitive: regExpCaseSensitive,
          dotAll: regExpDotAll,
          multiLine: regExpMultiLine,
          unicode: regExpUnicode)
          : null;
      // Validating with Strings
      RegExp? stringRegex;
      stringRegex = stringMatchMap != null
          ? RegExp(r'\b' + stringMatchMap!.keys.join('|').toString() + r'+\$',
          caseSensitive: regExpCaseSensitive,
          dotAll: regExpDotAll,
          multiLine: regExpMultiLine,
          unicode: regExpUnicode)
          : null;
      
      text.splitMapJoin(
        stringMatchMap == null ? allRegex! : stringRegex!,
        onNonMatch: (String span) {
          if (stringMatchMap != null &&
              children.isNotEmpty &&
              stringMatchMap!.keys.contains("${children.last.text}$span")) {
            final String? ks =
            stringMatchMap!["${children.last.text}$span"] != null
                ? stringMatchMap?.entries.lastWhere((element) {
              return element.key
                  .allMatches("${children.last.text}$span")
                  .isNotEmpty;
            }).key
                : '';

            children.add(TextSpan(text: span, style: stringMatchMap![ks!]));
            return span.toString();
          } else {
            children.add(TextSpan(text: span, style: style));
            return span.toString();
          }
        },
        onMatch: (Match m) {
          matches.add(m[0]!);
          final RegExp? k = patternMatchMap?.entries.firstWhere((element) {
            return element.key.allMatches(m[0]!).isNotEmpty;
          }).key;

          final String? ks = stringMatchMap?[m[0]] != null
              ? stringMatchMap?.entries.firstWhere((element) {
            return element.key.allMatches(m[0]!).isNotEmpty;
          }).key
              : '';
          if (deleteOnBack!) {
            if ((isBack(text, _lastValue) && m.end == selection.baseOffset)) {
              WidgetsBinding.instance.addPostFrameCallback((_) {
                children.removeWhere((element) => element.text! == text);
                text = text.replaceRange(m.start, m.end, "");
                selection = selection.copyWith(
                  baseOffset: m.end - (m.end - m.start),
                  extentOffset: m.end - (m.end - m.start),
                );
              });
            } else {
              children.add(
                TextSpan(
                  text: m[0],
                  style: stringMatchMap == null
                      ? patternMatchMap![k]
                      : stringMatchMap![ks],
                ),
              );
            }
          } else {
            children.add(
              TextSpan(
                text: m[0],
                style: stringMatchMap == null
                    ? patternMatchMap![k]
                    : stringMatchMap![ks],
              ),
            );
          }
          final resultMatchIndex = matchValueIndex(m);
          if (resultMatchIndex != null && onMatchIndex != null) {
            matchIndex.add(resultMatchIndex);
            onMatchIndex!(matchIndex);
          }

          return (onMatch(List<String>.unmodifiable(matches)) ?? '');
        },
      );

      _lastValue = text;
      return TextSpan(style: style, children: children);
    }

    final TextStyle composingStyle = style?.merge(const TextStyle(decoration: TextDecoration.underline))
        ?? const TextStyle(decoration: TextDecoration.underline);
    return TextSpan(
      children: <TextSpan>[
        TextSpan(style: style, children: buildRegExpSpan(context: context, text: value.composing.textBefore(value.text))),
        TextSpan(
          style: composingStyle,
          text: value.composing.textInside(value.text),
        ),
        TextSpan(style: style, children: buildRegExpSpan(context: context, text: value.composing.textAfter(value.text))),
      ],
    );
  }

  Map<String, List<int>>? matchValueIndex(Match match) {
    final matchValue = match[0]?.replaceFirstMapped('#', (match) => '');
    if (matchValue != null) {
      final firstMatchChar = match.start + 1;
      final lastMatchChar = match.end - 1;
      final compactMatch = {
        matchValue: [firstMatchChar, lastMatchChar]
      };
      return compactMatch;
    }
    return null;
  }

  List<TextSpan> buildRegExpSpan(
      {required BuildContext context,
        TextStyle? style,
        required String? text}) {
    List<TextSpan> children = [];
    if (!(text != null && text.isNotEmpty)) {
      return children;
    }
    final matches = <String>{};
    List<Map<String, List<int>>> matchIndex = [];

    // Validating with REGEX
    RegExp? allRegex;
    allRegex = patternMatchMap != null
        ? RegExp(patternMatchMap?.keys.map((e) => e.pattern).join('|') ?? "",
        caseSensitive: regExpCaseSensitive,
        dotAll: regExpDotAll,
        multiLine: regExpMultiLine,
        unicode: regExpUnicode)
        : null;
    // Validating with Strings
    RegExp? stringRegex;
    stringRegex = stringMatchMap != null
        ? RegExp(r'\b' + stringMatchMap!.keys.join('|').toString() + r'+\$',
        caseSensitive: regExpCaseSensitive,
        dotAll: regExpDotAll,
        multiLine: regExpMultiLine,
        unicode: regExpUnicode)
        : null;
    
    text.splitMapJoin(
      stringMatchMap == null ? allRegex! : stringRegex!,
      onNonMatch: (String span) {
        if (stringMatchMap != null &&
            children.isNotEmpty &&
            stringMatchMap!.keys.contains("${children.last.text}$span")) {
          final String? ks =
          stringMatchMap!["${children.last.text}$span"] != null
              ? stringMatchMap?.entries.lastWhere((element) {
            return element.key
                .allMatches("${children.last.text}$span")
                .isNotEmpty;
          }).key
              : '';

          children.add(TextSpan(text: span, style: stringMatchMap![ks!]));
          return span.toString();
        } else {
          children.add(TextSpan(text: span, style: style));
          return span.toString();
        }
      },
      onMatch: (Match m) {
        matches.add(m[0]!);
        final RegExp? k = patternMatchMap?.entries.firstWhere((element) {
          return element.key.allMatches(m[0]!).isNotEmpty;
        }).key;

        final String? ks = stringMatchMap?[m[0]] != null
            ? stringMatchMap?.entries.firstWhere((element) {
          return element.key.allMatches(m[0]!).isNotEmpty;
        }).key
            : '';
        if (deleteOnBack!) {
          if ((isBack(text!, _lastValue) && m.end == selection.baseOffset)) {
            WidgetsBinding.instance.addPostFrameCallback((_) {
              children.removeWhere((element) => element.text! == text);
              text = text!.replaceRange(m.start, m.end, "");
              selection = selection.copyWith(
                baseOffset: m.end - (m.end - m.start),
                extentOffset: m.end - (m.end - m.start),
              );
            });
          } else {
            children.add(
              TextSpan(
                text: m[0],
                style: stringMatchMap == null
                    ? patternMatchMap![k]
                    : stringMatchMap![ks],
              ),
            );
          }
        } else {
          children.add(
            TextSpan(
              text: m[0],
              style: stringMatchMap == null
                  ? patternMatchMap![k]
                  : stringMatchMap![ks],
            ),
          );
        }
        final resultMatchIndex = matchValueIndex(m);
        if (resultMatchIndex != null && onMatchIndex != null) {
          matchIndex.add(resultMatchIndex);
          onMatchIndex!(matchIndex);
        }

        return (onMatch(List<String>.unmodifiable(matches)) ?? '');
      },
    );
    return children;
  }
}

至此可以看到效果图中@张三 高亮显示了。

三、使用TextFieldController测试@张三 高亮

调整好TextFieldController后,我这里测试@张三 高亮

我们进行初始化TextFieldController

// Add a controller
  late TextFieldController _controller;

  
  void initState() {
    // TODO: implement initState
    _controller = TextFieldController(
      patternMatchMap: {
        //
        //* Returns every Hashtag with red color
        //
        RegExp(r"@[^\s]+\s?"):TextStyle(color:Colors.green),
        //
        //* Returns every Hashtag with red color
        //
        RegExp(r"\B#[a-zA-Z0-9]+\b"):TextStyle(color:Colors.red),
        //
        //* Returns every Mention with blue color and bold style.
        //
        RegExp(r"\B@[a-zA-Z0-9]+\b"):TextStyle(fontWeight: FontWeight.w800 ,color:Colors.blue,),
        //
        //* Returns every word after '!' with yellow color and italic style.
        //
        RegExp(r"\B![a-zA-Z0-9]+\b"):TextStyle(color:Colors.yellow, fontStyle:FontStyle.italic),
        // add as many expressions as you need!
      },
      //* starting v1.2.0
      // Now you have the option to add string Matching!
      // stringMatchMap: {
      //   "String1":TextStyle(color: Colors.red),
      //   "String2":TextStyle(color: Colors.yellow),
      // },
      //! Assertion: Only one of the two matching options can be given at a time!

      //* starting v1.1.0
      //* Now you have an onMatch callback that gives you access to a List<String>
      //* which contains all matched strings
      onMatch: (List<String> matches){
        // Do something with matches.
        //! P.S
        // as long as you're typing, the controller will keep updating the list.
      },
      deleteOnBack: true,
      // You can control the [RegExp] options used:
      regExpUnicode: true,
    );

    super.initState();
  }

在TextField中使用TextFieldController。具体代码如下

TextField(
        minLines: 1,
        maxLines: null,
        keyboardType: TextInputType.multiline,
        textAlignVertical: TextAlignVertical.center,
        autofocus: true,
        focusNode: editFocusNode,
        controller: _controller,
        textInputAction: TextInputAction.send,
        decoration: InputDecoration(
          contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 8.0),
          filled: true,
          isCollapsed: true,
          floatingLabelBehavior: FloatingLabelBehavior.never,
          hintText: "说点什么吧~",
          hintStyle: TextStyle(
            fontSize: 14,
            fontWeight: FontWeight.w400,
            fontStyle: FontStyle.normal,
            color: ColorUtil.hexColor(0xACACAC),
            decoration: TextDecoration.none,
          ),
          enabledBorder: OutlineInputBorder(
            /*边角*/
            borderRadius: const BorderRadius.all(
              Radius.circular(5.0), //边角为30
            ),
            borderSide: BorderSide(
              color: ColorUtil.hexColor(0xf7f7f7), //边框颜色为绿色
              width: 1, //边线宽度为1
            ),
          ),
          focusedBorder: OutlineInputBorder(
            borderRadius: const BorderRadius.all(
              Radius.circular(5.0), //边角为30
            ),
            borderSide: BorderSide(
              color: ColorUtil.hexColor(0xECECEC), //边框颜色为绿色
              width: 1, //宽度为1
            ),
          ),
        ),
      )

经过输入删除测试,输入的“@张三”高亮显示在TextField中正常了。

使用TextEditingController的buildTextSpan,可以查看:https://blog.csdn.net/gloryFlow/article/details/132889374
完善TextField输入框匹配正则表达式高亮显示,可以查看:https://blog.csdn.net/gloryFlow/article/details/132899084

四、小结

flutter聊天界面-TextField输入框buildTextSpan实现@功能展示高亮功能。自定义修改TextEditingController。
内容较多,描述可能不准确,请见谅。

本文地址:https://blog.csdn.net/gloryFlow/article/details/132899084

学习记录,每天不停进步。

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

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

相关文章

streamlit打包方式

Streamlit是一个开放的资源框架&#xff0c;用于将数据脚本转换为可共享的 Web 应用程序。它允许数据科学家和机器学习工程师构建直观的界面&#xff0c;而无需了解 Web 开发。在本教程中&#xff0c;我们将学习一些将 Streamlit 应用程序转换为双击可执行文件的方法&#xff0…

贪心(5)

绝对值不等式 |x-a||x-b|>|a-b| (中位数&#xff09; 仓库选址&#xff08;中位数就是最优解&#xff09; 在一条数轴上有 N 家商店&#xff0c;它们的坐标分别为 A1∼AN。 现在需要在数轴上建立一家货仓&#xff0c;每天清晨&#xff0c;从货仓到每家商店都要运送一车商…

山区自建房BCD浪涌保护器接线方案(自建房用电防雷)

家庭&#xff08;自建房&#xff09;电路防雷保护指南 家庭&#xff08;自建房&#xff09;电路防雷保护指南.png 已共享。 链接: https://pan.baidu.com/s/1xkwsIgizg4WvLJ8V3cd_ZQ?pwde9pv 提取码: e9pv 山区自建房BCD浪涌保护器接线方案。

小土堆pytorch学习笔记

想入门pytorch强化学习&#xff0c;就去找pytorch的课来看。B站上播放量最高的就是小土堆的课&#xff0c;整体跟下来感觉内容还是很详细的&#xff0c;但和我的预期不太一样&#xff0c;这个是DL的不是RL的&#xff0c;不过作为对于pytorch使用的初期了解也是很好的&#xff0…

【Linux网络编程】Socket-TCP实例

netstat -nltp 无法用read函数读取UDP套接字的数据&#xff0c;因为UDP是面向数据报&#xff0c;而TCP是面向数据流。 客户端不需要 bind&#xff0c;listen&#xff0c;accept&#xff0c;但是客户端需要connect&#xff0c;connect会自动做bind工作。 #include <sys/sock…

前端开发工作中可能会遇到的问题及解决方法

一、uni-app小程序中xxx代码依赖分析忽略二、uni-app弹窗列表滚动, 弹框下面的内容也跟随滚动三、uni-app小程序正常自定义组件不生效 四、uni-app popup 弹出层底部空隙问题 五、uni-app小程序自定义导航栏后iOS页面可上下滑动问题解决方案 六. uni-app中的分享二维码以及…

5个关键步骤助您顺利开发跑腿小程序

作为跑腿服务的热门方式&#xff0c;跑腿小程序的开发成为了许多创业者和企业的首选。然而&#xff0c;要成功开发一款出色的跑腿小程序&#xff0c;并不是一件轻松的事情。本文将为您揭示5个关键步骤&#xff0c;助您在开发跑腿小程序的道路上顺利前行。 步骤一&#xff1a;需…

java项目之固定资产管理系统(源码+文档)

风定落花生&#xff0c;歌声逐流水&#xff0c;大家好我是风歌&#xff0c;混迹在java圈的辛苦码农。今天要和大家聊的是一款基于ssm的固定资产管理系统。源码和部署相关看文章末尾&#xff01; 开发环境&#xff1a; 后端&#xff1a; 开发语言&#xff1a;Java 框架&…

Games101作业7 蒙特卡洛路径追踪

文章目录 基本思想基本代码问题1:我们采取每次弹射都弹射N跟光线&#xff0c;此时会发生指数爆炸问题2:这是一个递归的过程&#xff0c;递归的终止条件我们还没规定优化&#xff0c;对光源直接进行采样 本文不涉及:蒙特卡洛积分的原理以及渲染方程是如何推到出来&#xff0c;而…

长胜证券:全球年内最大IPO“首秀”,标普香港创业板指数即将归零?

当地时间周四&#xff0c;美股三大股指团体上涨。到收盘&#xff0c;道指涨0.96%&#xff0c;报34907.11点&#xff1b;标普500指数涨0.84%&#xff0c;报4505.10点&#xff1b;纳指涨0.81%&#xff0c;报13926.05点。 美国8月PPI数据、零售出售月率双双超预期。美国8月PPI同比…

【Feign】feignclient发送formdata请求

文章目录 前言实操示例代码注意 常见问题formdata类型的post请求&#xff0c;为什么参数会被拼到url上&#xff1f;分析总结 RequestPart只可以接收文件吗&#xff1f;分析一些示例注意 前言 小伙伴们在使用feign进行远程调用时&#xff0c;会遇到formdata类型的post请求&…

5.docker可视化工具(Portainer)

本文操作&#xff0c;在 192.168.204.102 机器执行 安装最新版 portainer&#xff0c;请使用 portainer/portainer-ce 镜像。图片来源&#xff1a;https://hub.docker.com/r/portainer/portainer。   来这里可查看最新版本&#xff1a;https://github.com/portainer/p…

SQL 注入攻击的原理是什么

什么是 SQL 注入攻击&#xff0c;SQL 注入攻击的原理是什么 SQL 注入攻击是一种常见的网络安全漏洞&#xff0c;攻击者可以通过注入恶意 SQL 语句来攻击 Web 应用程序。本篇文章将介绍 SQL 注入攻击的原理和如何防范 SQL 注入攻击&#xff0c;并提供一些代码示例。 什么是 SQL…

数据库逻辑透明-架构真题(二十九)

&#xff08;2020年&#xff09;假设某计算机字长为32位&#xff0c;该计算机文件管理系统磁盘空间管理采用位示图&#xff08;bitmap&#xff09;记录磁盘的使用情况。若磁盘的容量为300GB&#xff0c;物理块大小为4MB&#xff0c;那么位示图的大小为&#xff08;&#xff09;…

LeetCode LCR 026. 重排链表

LCR 026. 重排链表 中等 128 相关企业 给定一个单链表 L 的头节点 head &#xff0c;单链表 L 表示为&#xff1a; L0 → L1 → … → Ln-1 → Ln 请将其重新排列后变为&#xff1a; L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → … 不能只是单纯的改变节点内部的值&#xff0c…

服务拓扑串联难?eBPF为滴滴可观测带来解题新思路

上篇文章我们讲到可观测性在滴滴的实践与落地&#xff0c;更多关注的是不同观测信号之间的关联关系。那服务与服务之间的关系又如何串联&#xff0c;业界当前爆火的 ebpf 又在滴滴有着怎样的应用&#xff0c;本文为你揭晓。 背景 业务介绍&#xff1a;业务接口调用观测 滴滴可观…

基于Linux对MySQL数据库的安全加固指南(超实用--实战版)

&#x1f468;‍&#x1f393;博主简介 &#x1f3c5;云计算领域优质创作者   &#x1f3c5;华为云开发者社区专家博主   &#x1f3c5;阿里云开发者社区专家博主 &#x1f48a;交流社区&#xff1a;运维交流社区 欢迎大家的加入&#xff01; &#x1f40b; 希望大家多多支…

零基础学前端(四)重点讲解 CSS

1. 该篇适用于从零基础学习前端的小白 2. 初学者不懂代码得含义也要坚持模仿逐行敲代码&#xff0c;以身体感悟带动头脑去理解新知识 3. 初学者切忌&#xff0c;不要眼花缭乱&#xff0c;不要四处找其它文档&#xff0c;要坚定一个教授者的方式&#xff0c;将其学通透&#xff…

柏曼的护眼台灯怎么样?明基、书客、柏曼护眼台灯测评对比

台灯是最常见的一种照明灯具&#xff0c;基本每家每户都有着一台&#xff0c;大多数是给孩子学习使用的。而且现在的孩子学习压力都非常繁重&#xff0c;导致很多孩子早早就开始近视了。不少家长也开始重视孩子的视力健康&#xff0c;给孩子挑选护眼台灯。不过市面上的护眼台灯…

抖去推爆款视频生成器怎么制作开发?--短视频矩阵系统研发

在当今的数字时代&#xff0c;短视频已经成为一种非常受欢迎的内容形式。人们通过观看短视频来获取娱乐、学习和营销信息。然而&#xff0c;制作优秀的爆款视频并不容易&#xff0c;这需要创意、技能和时间。为了简化这一过程&#xff0c;抖去推推出了一款爆款视频生成器&#…