如何用VSCode和Clangd与Clang-Format插件高效阅读Linux内核源码及写驱动

一、如何高效阅读Linux源码:基于clangd

uboot/busybox等都可以用这种方式,理论上说所有基于Make和Cmake的源码工程都可以用这套方案

阅读Linux源码最大问题在于调用链太复杂,一个函数或变量引用太多,source insight和cscope等基于文本检索类似的工具,分析都不够精确,clangd是在编译过程分析调用关系,结果要准确地多,使用效果极佳。下面截取几个图展示下clangd的强大之处

Kconfig和Makefile中定义的配置项宏如果为0,Clangd检索完VScode会把没走到的分支自动注释掉,大大降低我们分析源码时走错分支的可能性

请添加图片描述

右键ShowCallHierarchy调用栈分析一步到位

请添加图片描述

精准强大的代码补全

在写驱动时,对内核方法和对象的提示非常全和准确
请添加图片描述

创建索引非常快,5.10.99的内核全量创建索引只需约2分钟,busybox和uboot的源码十几秒就好了

创建索引非常快,5.10.99的内核全量创建索引只需约2分钟,busybox和uboot的源码十几秒就好了

搭建教程参考

https://blog.csdn.net/thisway_diy/article/details/127426986

二、写驱动时如何自动格式化并(最好和Linux内核源码一个风格!!!)

1.VScode安装Clang-Format插件

左侧插件市场搜索直接安装即可

2.给系统安装clang-format

以Ubuntu为例,其他系统类似

sudo apt-get install clang-format

3.从Linux源码根目录把.clang-format文件拷贝到自己的项目目录

5.10.99亲测官方源码就有.clang-format文件,不过4.x版本没有,应该是5.x引进的,方便内核开发人员统一编码风格的

防止的Linux内核源码版本低,这里拷贝一份过来,大家可以在自己的工程目录手动创建.clang-format文件,并把下面的内容复制进去

# SPDX-License-Identifier: GPL-2.0
#
# clang-format configuration file. Intended for clang-format >= 4.
#
# For more information, see:
#
#   Documentation/process/clang-format.rst
#   https://clang.llvm.org/docs/ClangFormat.html
#   https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
---
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:AfterClass: falseAfterControlStatement: falseAfterEnum: falseAfterFunction: trueAfterNamespace: trueAfterObjCDeclaration: falseAfterStruct: falseAfterUnion: false#AfterExternBlock: false # Unknown to clang-format-5.0BeforeCatch: falseBeforeElse: falseIndentBraces: false#SplitEmptyFunction: true # Unknown to clang-format-4.0#SplitEmptyRecord: true # Unknown to clang-format-4.0#SplitEmptyNamespace: true # Unknown to clang-format-4.0
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
#CompactNamespaces: false # Unknown to clang-format-4.0
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
#FixNamespaceComments: false # Unknown to clang-format-4.0# Taken from:
#   git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \
#   | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$,  - '\1'," \
#   | sort | uniq
ForEachMacros:- 'apei_estatus_for_each_section'- 'ata_for_each_dev'- 'ata_for_each_link'- '__ata_qc_for_each'- 'ata_qc_for_each'- 'ata_qc_for_each_raw'- 'ata_qc_for_each_with_internal'- 'ax25_for_each'- 'ax25_uid_for_each'- '__bio_for_each_bvec'- 'bio_for_each_bvec'- 'bio_for_each_bvec_all'- 'bio_for_each_integrity_vec'- '__bio_for_each_segment'- 'bio_for_each_segment'- 'bio_for_each_segment_all'- 'bio_list_for_each'- 'bip_for_each_vec'- 'bitmap_for_each_clear_region'- 'bitmap_for_each_set_region'- 'blkg_for_each_descendant_post'- 'blkg_for_each_descendant_pre'- 'blk_queue_for_each_rl'- 'bond_for_each_slave'- 'bond_for_each_slave_rcu'- 'bpf_for_each_spilled_reg'- 'btree_for_each_safe128'- 'btree_for_each_safe32'- 'btree_for_each_safe64'- 'btree_for_each_safel'- 'card_for_each_dev'- 'cgroup_taskset_for_each'- 'cgroup_taskset_for_each_leader'- 'cpufreq_for_each_entry'- 'cpufreq_for_each_entry_idx'- 'cpufreq_for_each_valid_entry'- 'cpufreq_for_each_valid_entry_idx'- 'css_for_each_child'- 'css_for_each_descendant_post'- 'css_for_each_descendant_pre'- 'device_for_each_child_node'- 'dma_fence_chain_for_each'- 'do_for_each_ftrace_op'- 'drm_atomic_crtc_for_each_plane'- 'drm_atomic_crtc_state_for_each_plane'- 'drm_atomic_crtc_state_for_each_plane_state'- 'drm_atomic_for_each_plane_damage'- 'drm_client_for_each_connector_iter'- 'drm_client_for_each_modeset'- 'drm_connector_for_each_possible_encoder'- 'drm_for_each_bridge_in_chain'- 'drm_for_each_connector_iter'- 'drm_for_each_crtc'- 'drm_for_each_encoder'- 'drm_for_each_encoder_mask'- 'drm_for_each_fb'- 'drm_for_each_legacy_plane'- 'drm_for_each_plane'- 'drm_for_each_plane_mask'- 'drm_for_each_privobj'- 'drm_mm_for_each_hole'- 'drm_mm_for_each_node'- 'drm_mm_for_each_node_in_range'- 'drm_mm_for_each_node_safe'- 'flow_action_for_each'- 'for_each_active_dev_scope'- 'for_each_active_drhd_unit'- 'for_each_active_iommu'- 'for_each_aggr_pgid'- 'for_each_available_child_of_node'- 'for_each_bio'- 'for_each_board_func_rsrc'- 'for_each_bvec'- 'for_each_card_auxs'- 'for_each_card_auxs_safe'- 'for_each_card_components'- 'for_each_card_dapms'- 'for_each_card_pre_auxs'- 'for_each_card_prelinks'- 'for_each_card_rtds'- 'for_each_card_rtds_safe'- 'for_each_card_widgets'- 'for_each_card_widgets_safe'- 'for_each_cgroup_storage_type'- 'for_each_child_of_node'- 'for_each_clear_bit'- 'for_each_clear_bit_from'- 'for_each_cmsghdr'- 'for_each_compatible_node'- 'for_each_component_dais'- 'for_each_component_dais_safe'- 'for_each_comp_order'- 'for_each_console'- 'for_each_cpu'- 'for_each_cpu_and'- 'for_each_cpu_not'- 'for_each_cpu_wrap'- 'for_each_dapm_widgets'- 'for_each_dev_addr'- 'for_each_dev_scope'- 'for_each_displayid_db'- 'for_each_dma_cap_mask'- 'for_each_dpcm_be'- 'for_each_dpcm_be_rollback'- 'for_each_dpcm_be_safe'- 'for_each_dpcm_fe'- 'for_each_drhd_unit'- 'for_each_dss_dev'- 'for_each_efi_memory_desc'- 'for_each_efi_memory_desc_in_map'- 'for_each_element'- 'for_each_element_extid'- 'for_each_element_id'- 'for_each_endpoint_of_node'- 'for_each_evictable_lru'- 'for_each_fib6_node_rt_rcu'- 'for_each_fib6_walker_rt'- 'for_each_free_mem_pfn_range_in_zone'- 'for_each_free_mem_pfn_range_in_zone_from'- 'for_each_free_mem_range'- 'for_each_free_mem_range_reverse'- 'for_each_func_rsrc'- 'for_each_hstate'- 'for_each_if'- 'for_each_iommu'- 'for_each_ip_tunnel_rcu'- 'for_each_irq_nr'- 'for_each_link_codecs'- 'for_each_link_cpus'- 'for_each_link_platforms'- 'for_each_lru'- 'for_each_matching_node'- 'for_each_matching_node_and_match'- 'for_each_member'- 'for_each_mem_region'- 'for_each_memblock_type'- 'for_each_memcg_cache_index'- 'for_each_mem_pfn_range'- '__for_each_mem_range'- 'for_each_mem_range'- '__for_each_mem_range_rev'- 'for_each_mem_range_rev'- 'for_each_migratetype_order'- 'for_each_msi_entry'- 'for_each_msi_entry_safe'- 'for_each_net'- 'for_each_net_continue_reverse'- 'for_each_netdev'- 'for_each_netdev_continue'- 'for_each_netdev_continue_rcu'- 'for_each_netdev_continue_reverse'- 'for_each_netdev_feature'- 'for_each_netdev_in_bond_rcu'- 'for_each_netdev_rcu'- 'for_each_netdev_reverse'- 'for_each_netdev_safe'- 'for_each_net_rcu'- 'for_each_new_connector_in_state'- 'for_each_new_crtc_in_state'- 'for_each_new_mst_mgr_in_state'- 'for_each_new_plane_in_state'- 'for_each_new_private_obj_in_state'- 'for_each_node'- 'for_each_node_by_name'- 'for_each_node_by_type'- 'for_each_node_mask'- 'for_each_node_state'- 'for_each_node_with_cpus'- 'for_each_node_with_property'- 'for_each_nonreserved_multicast_dest_pgid'- 'for_each_of_allnodes'- 'for_each_of_allnodes_from'- 'for_each_of_cpu_node'- 'for_each_of_pci_range'- 'for_each_old_connector_in_state'- 'for_each_old_crtc_in_state'- 'for_each_old_mst_mgr_in_state'- 'for_each_oldnew_connector_in_state'- 'for_each_oldnew_crtc_in_state'- 'for_each_oldnew_mst_mgr_in_state'- 'for_each_oldnew_plane_in_state'- 'for_each_oldnew_plane_in_state_reverse'- 'for_each_oldnew_private_obj_in_state'- 'for_each_old_plane_in_state'- 'for_each_old_private_obj_in_state'- 'for_each_online_cpu'- 'for_each_online_node'- 'for_each_online_pgdat'- 'for_each_pci_bridge'- 'for_each_pci_dev'- 'for_each_pci_msi_entry'- 'for_each_pcm_streams'- 'for_each_physmem_range'- 'for_each_populated_zone'- 'for_each_possible_cpu'- 'for_each_present_cpu'- 'for_each_prime_number'- 'for_each_prime_number_from'- 'for_each_process'- 'for_each_process_thread'- 'for_each_property_of_node'- 'for_each_registered_fb'- 'for_each_requested_gpio'- 'for_each_requested_gpio_in_range'- 'for_each_reserved_mem_range'- 'for_each_reserved_mem_region'- 'for_each_rtd_codec_dais'- 'for_each_rtd_codec_dais_rollback'- 'for_each_rtd_components'- 'for_each_rtd_cpu_dais'- 'for_each_rtd_cpu_dais_rollback'- 'for_each_rtd_dais'- 'for_each_set_bit'- 'for_each_set_bit_from'- 'for_each_set_clump8'- 'for_each_sg'- 'for_each_sg_dma_page'- 'for_each_sg_page'- 'for_each_sgtable_dma_page'- 'for_each_sgtable_dma_sg'- 'for_each_sgtable_page'- 'for_each_sgtable_sg'- 'for_each_sibling_event'- 'for_each_subelement'- 'for_each_subelement_extid'- 'for_each_subelement_id'- '__for_each_thread'- 'for_each_thread'- 'for_each_unicast_dest_pgid'- 'for_each_wakeup_source'- 'for_each_zone'- 'for_each_zone_zonelist'- 'for_each_zone_zonelist_nodemask'- 'fwnode_for_each_available_child_node'- 'fwnode_for_each_child_node'- 'fwnode_graph_for_each_endpoint'- 'gadget_for_each_ep'- 'genradix_for_each'- 'genradix_for_each_from'- 'hash_for_each'- 'hash_for_each_possible'- 'hash_for_each_possible_rcu'- 'hash_for_each_possible_rcu_notrace'- 'hash_for_each_possible_safe'- 'hash_for_each_rcu'- 'hash_for_each_safe'- 'hctx_for_each_ctx'- 'hlist_bl_for_each_entry'- 'hlist_bl_for_each_entry_rcu'- 'hlist_bl_for_each_entry_safe'- 'hlist_for_each'- 'hlist_for_each_entry'- 'hlist_for_each_entry_continue'- 'hlist_for_each_entry_continue_rcu'- 'hlist_for_each_entry_continue_rcu_bh'- 'hlist_for_each_entry_from'- 'hlist_for_each_entry_from_rcu'- 'hlist_for_each_entry_rcu'- 'hlist_for_each_entry_rcu_bh'- 'hlist_for_each_entry_rcu_notrace'- 'hlist_for_each_entry_safe'- '__hlist_for_each_rcu'- 'hlist_for_each_safe'- 'hlist_nulls_for_each_entry'- 'hlist_nulls_for_each_entry_from'- 'hlist_nulls_for_each_entry_rcu'- 'hlist_nulls_for_each_entry_safe'- 'i3c_bus_for_each_i2cdev'- 'i3c_bus_for_each_i3cdev'- 'ide_host_for_each_port'- 'ide_port_for_each_dev'- 'ide_port_for_each_present_dev'- 'idr_for_each_entry'- 'idr_for_each_entry_continue'- 'idr_for_each_entry_continue_ul'- 'idr_for_each_entry_ul'- 'in_dev_for_each_ifa_rcu'- 'in_dev_for_each_ifa_rtnl'- 'inet_bind_bucket_for_each'- 'inet_lhash2_for_each_icsk_rcu'- 'key_for_each'- 'key_for_each_safe'- 'klp_for_each_func'- 'klp_for_each_func_safe'- 'klp_for_each_func_static'- 'klp_for_each_object'- 'klp_for_each_object_safe'- 'klp_for_each_object_static'- 'kunit_suite_for_each_test_case'- 'kvm_for_each_memslot'- 'kvm_for_each_vcpu'- 'list_for_each'- 'list_for_each_codec'- 'list_for_each_codec_safe'- 'list_for_each_continue'- 'list_for_each_entry'- 'list_for_each_entry_continue'- 'list_for_each_entry_continue_rcu'- 'list_for_each_entry_continue_reverse'- 'list_for_each_entry_from'- 'list_for_each_entry_from_rcu'- 'list_for_each_entry_from_reverse'- 'list_for_each_entry_lockless'- 'list_for_each_entry_rcu'- 'list_for_each_entry_reverse'- 'list_for_each_entry_safe'- 'list_for_each_entry_safe_continue'- 'list_for_each_entry_safe_from'- 'list_for_each_entry_safe_reverse'- 'list_for_each_prev'- 'list_for_each_prev_safe'- 'list_for_each_safe'- 'llist_for_each'- 'llist_for_each_entry'- 'llist_for_each_entry_safe'- 'llist_for_each_safe'- 'mci_for_each_dimm'- 'media_device_for_each_entity'- 'media_device_for_each_intf'- 'media_device_for_each_link'- 'media_device_for_each_pad'- 'nanddev_io_for_each_page'- 'netdev_for_each_lower_dev'- 'netdev_for_each_lower_private'- 'netdev_for_each_lower_private_rcu'- 'netdev_for_each_mc_addr'- 'netdev_for_each_uc_addr'- 'netdev_for_each_upper_dev_rcu'- 'netdev_hw_addr_list_for_each'- 'nft_rule_for_each_expr'- 'nla_for_each_attr'- 'nla_for_each_nested'- 'nlmsg_for_each_attr'- 'nlmsg_for_each_msg'- 'nr_neigh_for_each'- 'nr_neigh_for_each_safe'- 'nr_node_for_each'- 'nr_node_for_each_safe'- 'of_for_each_phandle'- 'of_property_for_each_string'- 'of_property_for_each_u32'- 'pci_bus_for_each_resource'- 'pcm_for_each_format'- 'ping_portaddr_for_each_entry'- 'plist_for_each'- 'plist_for_each_continue'- 'plist_for_each_entry'- 'plist_for_each_entry_continue'- 'plist_for_each_entry_safe'- 'plist_for_each_safe'- 'pnp_for_each_card'- 'pnp_for_each_dev'- 'protocol_for_each_card'- 'protocol_for_each_dev'- 'queue_for_each_hw_ctx'- 'radix_tree_for_each_slot'- 'radix_tree_for_each_tagged'- 'rbtree_postorder_for_each_entry_safe'- 'rdma_for_each_block'- 'rdma_for_each_port'- 'rdma_umem_for_each_dma_block'- 'resource_list_for_each_entry'- 'resource_list_for_each_entry_safe'- 'rhl_for_each_entry_rcu'- 'rhl_for_each_rcu'- 'rht_for_each'- 'rht_for_each_entry'- 'rht_for_each_entry_from'- 'rht_for_each_entry_rcu'- 'rht_for_each_entry_rcu_from'- 'rht_for_each_entry_safe'- 'rht_for_each_from'- 'rht_for_each_rcu'- 'rht_for_each_rcu_from'- '__rq_for_each_bio'- 'rq_for_each_bvec'- 'rq_for_each_segment'- 'scsi_for_each_prot_sg'- 'scsi_for_each_sg'- 'sctp_for_each_hentry'- 'sctp_skb_for_each'- 'shdma_for_each_chan'- '__shost_for_each_device'- 'shost_for_each_device'- 'sk_for_each'- 'sk_for_each_bound'- 'sk_for_each_entry_offset_rcu'- 'sk_for_each_from'- 'sk_for_each_rcu'- 'sk_for_each_safe'- 'sk_nulls_for_each'- 'sk_nulls_for_each_from'- 'sk_nulls_for_each_rcu'- 'snd_array_for_each'- 'snd_pcm_group_for_each_entry'- 'snd_soc_dapm_widget_for_each_path'- 'snd_soc_dapm_widget_for_each_path_safe'- 'snd_soc_dapm_widget_for_each_sink_path'- 'snd_soc_dapm_widget_for_each_source_path'- 'tb_property_for_each'- 'tcf_exts_for_each_action'- 'udp_portaddr_for_each_entry'- 'udp_portaddr_for_each_entry_rcu'- 'usb_hub_for_each_child'- 'v4l2_device_for_each_subdev'- 'v4l2_m2m_for_each_dst_buf'- 'v4l2_m2m_for_each_dst_buf_safe'- 'v4l2_m2m_for_each_src_buf'- 'v4l2_m2m_for_each_src_buf_safe'- 'virtio_device_for_each_vq'- 'while_for_each_ftrace_op'- 'xa_for_each'- 'xa_for_each_marked'- 'xa_for_each_range'- 'xa_for_each_start'- 'xas_for_each'- 'xas_for_each_conflict'- 'xas_for_each_marked'- 'xbc_array_for_each_value'- 'xbc_for_each_key_value'- 'xbc_node_for_each_array_value'- 'xbc_node_for_each_child'- 'xbc_node_for_each_key_value'- 'zorro_for_each_dev'#IncludeBlocks: Preserve # Unknown to clang-format-5.0
IncludeCategories:- Regex: '.*'Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
#IndentPPDirectives: None # Unknown to clang-format-5.0
IndentWidth: 8
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
ObjCBlockIndentWidth: 8
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true# Taken from git's rules
#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyExcessCharacter: 100
PenaltyReturnTypeOnItsOwnLine: 60PointerAlignment: Right
ReflowComments: false
SortIncludes: false
#SortUsingDeclarations: false # Unknown to clang-format-4.0
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp03
TabWidth: 8
UseTab: Always
...

4.设置clang-format为默认格式化插件

操作如下
请添加图片描述

5.设置格式化时机为format on save

请添加图片描述

6.打开自己的代码文件,随便修改点,按Ctrl+S保存,代码即可自动格式化,而且和内核风格完全一样

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

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

相关文章

Pink老师Echarts教学笔记

可视化面板介绍 ​ 应对现在数据可视化的趋势,越来越多企业需要在很多场景(营销数据,生产数据,用户数据)下使用,可视化图表来展示体现数据,让数据更加直观,数据特点更加突出。 01-使用技术 完成该项目需…

阿里云服务器(Ubuntu22)上的MySQL8数据库下载,安装和远程连接

最近阿里云centos主机到期了改为使用Ubuntu操作系统,在上面安装mysql并远程连接出现了一系列问题并解决。 之前在centos系统上下载mysql8的教程如下: 阿里云服务器(centos7)上的MySQL8数据库下载,安装和远程连接 主机操…

【小沐学Python】Python实现Web图表功能(Lux)

文章目录 1、简介2、安装3、测试3.1 入门示例3.2 入门示例2 结语 1、简介 https://github.com/lux-org/lux 用于智能可视化发现的 Python API Lux 是一个 Python 库,通过自动化可视化和数据分析过程来促进快速简便的数据探索。通过简单地在 Jupyter 笔记本中打印出…

招聘自媒体编辑岗位的人才测评方案

人才测评工具在招聘入职的方案,在线工具网根据自媒体岗位的特性和需求来分析,并制定自媒体主编的测评方案。 自媒体作为互联网时代的产物,自然也为我们带来了很多的福利,例如:海量的信息、快捷的传媒方式,那…

百度网盘联盟申请盘主的方法

在百度网盘联盟目前有3种赚钱方式,第一种是自己售卡赚佣金;第二种是外链分享(分销联盟);第三种是邀请好友加盟,好友售卡,自己得提成收入,需要申请盘主后即可开始 申请盘主&#xff1…

3个Tips,用“AI”开启新生活

相信最近,很多朋友们都回归到了忙碌的生活节奏中。生活模式的切换,或多或少会带来身体或情绪状况的起伏。新技术正在为人们生活的方方面面带来便利。3个小Tips或许能让你也从新技术中获益,从身到心,用“AI”开启新生活。 关”A…

RAPTOR:树结构的索引和检索系统的递归抽象处理

论文地址:https://arxiv.org/pdf/2401.18059.pdf 摘 要 增强型检索语言模型能够更好地适应世界状态的变化,并整合长尾知识,然而现有大多数方法仅能从检索语料库中检索到较短的连续文本片段,这限制了对整个文档上下文的整体理解。…

强化学习之父Richard Sutton:通往AGI的另一种可能

2019年,强化学习之父、阿尔伯塔大学教授Richard Sutton发表了后来被AI领域奉为经典的The Bitter lesson,这也是OpenAI研究员的必读文章。 在这篇文章中,Richard指出,过去 70 年来,AI 研究的一大教训是过于重视人类既有…

文件包含一-WEB攻防-PHP应用文件包含LFIRFI伪协议编码算法无文件利用黑白盒

演示案例: 文件包含-原理&分类&利用&修复黑盒利用-VULWEB-有无包含文件白盒利用-CTFSHOW-伪协议玩法 #文件包含-原理&分类&利用&修复 1、原理 程序开发人员通常会把可重复使用的函数写到单个文件中,在使用某些函数时&#xff0c…

Webman全局异常捕获处理

最近在使用webman这个框架做项目开发,涉及到需要统一处理异常捕获。由于官网给的并不详细,于是自己实现了一下全局异常处理类。 一、配置效果 例如:我要在项目中统一返回json 格式数据,并不想在业务层写try,catch逻辑。 或者在业务…

下载安装anaconda和pytorch的详细方法,以及遇到的问题和解决办法

下载安装Anaconda 首先需要下载Anaconda,可以到官网Anaconda官网或者这里提供一个镜像网站去下载anaconda镜像网站 安装步骤可参考该文章:Anaconda安装步骤,本篇不再赘述 注意环境变量的配置,安装好Anaconda之后一定要在环境变量…

使用POI以OLE对象的形式向excel中插入附件(pdf为例)

前言: 最近在使用easyExcel操作excel文件时,一直想找到一个方法可以往excel中填充附件,但是目前只发现POI可以插入附件,于是将方法记录如下: 实现: 这个方法主要是使用 Apache POI 的 HSSFWorkbook 类来…

【Java初阶(四)】数组的定义和使用

❣博主主页: 33的博客❣ ▶文章专栏分类: Java从入门到精通◀ 🚚我的代码仓库: 33的代码仓库🚚 目录 1.前言2.数组的概念2.1数组的初始化2.2数组的使用2.2.1数组元素访问2.2.2遍历数组 3.数组是引用类型3.1实例3.2 认识null 4.数组的应用4.1 二分查找4.2…

AQS源码分析

前言 AbstractQueuedSynchronizer是抽象同步队列,其是实现同步机器的基础组件,并发包中的锁的底层就是使用AQS实现的。AQS中 维护了一个volatile int state(代表共享资源)和一个FIFO线程等待队列(多线程争用资源被阻塞…

MySQL面试题--开发(最全,涵盖SQL基础、架构、事务)

MySQL面试题--事务https://mp.csdn.net/mp_blog/creation/editor/136947072 MySQL面试题--MySQL内部技术架构https://blog.csdn.net/Timebro/article/details/136946046?spm1001.2014.3001.5501 MySQL面试题--最全面-索引https://blog.csdn.net/Timebro/article/details/136…

计算机实体安全

计算机实体安全定义: 对场地环境、设施、设备和载体、人员采取的安全对策和措施。 一、计算机可靠性与故障分析 1.1 计算机的可靠性 可靠性 (狭义) ■计算机在规定时间与条件下完成规定功能的 概率 ■规定条件:环境条件,使用条件&#xff0…

软件高级:软件架构评估-基于场景的评估方法

作者:明明如月学长, CSDN 博客专家,大厂高级 Java 工程师,《性能优化方法论》作者、《解锁大厂思维:剖析《阿里巴巴Java开发手册》》、《再学经典:《Effective Java》独家解析》专栏作者。 热门文章推荐&am…

Android Studio 和 lombok 的版本适配、gradle依赖配置、插件安装及使用

文章目录 Intro注意事项Android Studio 和 lombok 的版本选择及下载下载链接 在 Android Studio 中安装一次 lombok 插件在每个 gradle 项目中添加 lombok 相关依赖(如要用到)使用ref Intro 用惯了 JavaMavenIDEA 开发后端服务,突然有一天用 JavaGradleAndroidStud…

C# WPF编程-事件

C# WPF编程-路由事件 路由事件概要路由事件的三种方式 WPF事件WPF最重要的5类事件:生命周期事件 鼠标事件键盘事件多点触控输入原始触控 路由事件概要 路由事件是具有更强传播能力的事件,它们可在元素树中向上冒泡和向下隧道传播,并沿着传播…

端口的学习

端口是什么口?【网络常识3】_哔哩哔哩_bilibili 简化后的数据包: 软件和端口是1对多的关系。 http默认端口是80 https默认端口是443