当前位置: 首页 > news >正文

WordPress:Locoy.php火车头采集

<?php
/*
模块参数列表:
post_title 必选 标题 
post_content 必选 内容 
tag 可选 标签 
post_category 可选 分类
post_date 可选 时间
post_excerpt 可选 摘要
post_author 可选 作者
category_description 可选 分类信息
post_cate_meta[name] 可选 自定义分类信息 
post_meta[name] 可选 自定义字段 
post_type 可选 文章类型 默认为'post'
post_taxonomy 可选 自定义分类方式
post_format 可选 文章形式
*/
//-------------------配置参数开始,根据需要修改-------------------------
$post_author_default = 1; //默认作者的id,默认为admin(这里是作者ID号码,并非作者名)
$post_status = 'publish'; //立即发布 pending 审核 draft 草稿箱
$time_interval = 1; //发布时间间隔,单位为秒 。可设置随机数值表达式,如12345 * rand(0,17),设置为负数可将发布时间设置为当前时间减去这里设置的时间
$post_next = 'now'; //now:发布时间=当前时间+间隔时间值 //next: 发布时间=最后一篇时间+间隔时间值 
$post_ping = false; //发布后是否执行ping
$translate_slug = false; //是否将中文标题转换为MD5值,如需开启请设置为true或MD5值长度,建议设置为大于10,小于33的数字。
$secretWord = 'buzhidao'; //接口密码,如果不需要密码,则设为$secretWord=false ; 
$checkTitle = true; //检测标题是否重复
$updateTitle = true; //标题重复是否更新
$postformat = false; //开启文章形式
//-------------------配置参数结束,以下请勿修改-------------------------//开始
if(isset($_GET['action'])){
$hm_action=$_GET['action'];
}else{
die("操作被禁止>");
}
include_once "./wp-config.php";
if($post_ping) require_once("./wp-includes/comment.php");
extract($_POST);
if($hm_action== "list"){
hm_print_catogary_list();
}elseif($hm_action== "update"){
hm_publish_pending_post();
}elseif($hm_action == "save"){
//检查通讯密码
if (isset($secretWord)&&($secretWord!=false)) {
if (!isset($_GET['secret']) || $_GET['secret'] != $secretWord) {
die('接口密码错误,请修改配置文件或者修改发布参数,保持两者统一。');
}
}
//判断标题是否为空
if ($post_title=='[标题]'||$post_title=='') {die('标题为空');}
//判断标题是否为空
// if ($post_content=='[内容]'||$post_content=='') {die('内容为空');}
//检查自定义文章类型
if (empty($post_type) || strpos($post_type, '[') || strpos($post_type, ']')) {$post_type='post';}
//检查自定义分类目录
if (empty($post_taxonomy) || strpos($post_taxonomy, '[') || strpos($post_taxonomy, ']')) {$post_taxonomy='category';}
//检查分类描述是否未设置
if (empty($category_description) || strpos($category_description, '[') || strpos($category_description, ']')) {$category_description='';}
//检查自定义字段
if(array_key_exists('post_meta', $post)){$post_meta = $post['post_meta'];}
//检查自定义分类信息
if(array_key_exists('post_cate_meta', $post)){$post_cate_meta = $post['post_cate_meta'];}
//检查发布时间
if (!isset($post_date) ||strlen($post_date)<8) $post_date=false;
//检查作者
if (empty($post_author)) {
$post_author=$post_author_default;
} else {
$post_author=hm_add_author($post_author);
}
$post_content = fileHandle('fujian',$post_content);
fileHandle('thumb');
//检查标题是否重复
if($checkTitle){
$post_title = trim(hm_strip_slashes($post_title));
$sql = "SELECT `ID` FROM $wpdb->posts WHERE `post_title` = '$post_title'";
$t_row = $wpdb->query($sql);
if($t_row) {
//标题重复更新
if($updateTitle){
//2023.03.01 Start 采集开启标题重复测试后,开启自动更新功能 xdy
$Post_ID = $wpdb->get_col($sql);
$Post_ID = $Post_ID[0];
//print_r($_POST);
$_seo_title = $_POST['post_meta']['titleseo'];
$_sites_link = $_POST['post_meta']['_sites_link']; //wangzhi
$_sites_sescribe = $_POST['post_meta']['_sites_sescribe']; //pingjia
$paixu = $_POST['post_meta']['paixu'];
$beian = $_POST['post_meta']['beian'];
$similarweb = $_POST['post_meta']['similarweb'];
$laiyuan = $_POST['post_meta']['laiyuan'];
$jibie = $_POST['post_meta']['jibie'];
$wangzhi1 = $_POST['post_meta']['wangzhi1'];
$wangzhi2 = $_POST['post_meta']['wangzhi2'];
$wangzhi3 = $_POST['post_meta']['wangzhi3'];
$wangzhi4 = $_POST['post_meta']['wangzhi4'];
$wangzhi5 = $_POST['post_meta']['wangzhi5'];
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$_sites_link' WHERE `post_id` = '$Post_ID' AND `meta_key` = '_sites_link'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$_seo_title' WHERE `post_id` = '$Post_ID' AND `meta_key` = '_seo_title'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$_sites_sescribe' WHERE `post_id` = '$Post_ID' AND `meta_key` = '_sites_sescribe'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$paixu' WHERE `post_id` = '$Post_ID' AND `meta_key` = 'paixu'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$beian' WHERE `post_id` = '$Post_ID' AND `meta_key` = 'beian'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$similarweb' WHERE `post_id` = '$Post_ID' AND `meta_key` = 'similarweb'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$laiyuan' WHERE `post_id` = '$Post_ID' AND `meta_key` = 'laiyuan'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$jibie' WHERE `post_id` = '$Post_ID' AND `meta_key` = 'jibie'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$wangzhi1' WHERE `post_id` = '$Post_ID' AND `meta_key` = 'wangzhi1'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$wangzhi2' WHERE `post_id` = '$Post_ID' AND `meta_key` = 'wangzhi2'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$wangzhi3' WHERE `post_id` = '$Post_ID' AND `meta_key` = 'wangzhi3'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$wangzhi4' WHERE `post_id` = '$Post_ID' AND `meta_key` = 'wangzhi4'");
$wpdb->get_results("UPDATE `wp_postmeta` SET `meta_value` = '$wangzhi5' WHERE `post_id` = '$Post_ID' AND `meta_key` = 'wangzhi5'");
$wpdb->get_results("UPDATE $wpdb->posts SET `post_content` = '$post_content' , `post_excerpt` = '$post_excerpt' , `post_type` = '$post_type' , `post_date` = '$post_date' , `post_author` = '$post_author' WHERE `post_title` = '$post_title'");
die('标题已存在,内容已更新');
//2023.03.01 End xdy
}else{
die('标题已存在');
}
};
}
hm_do_save_post(array('post_title'=>$post_title,
'post_content'=>$post_content,
'post_category'=>$post_category,
'post_excerpt'=>$post_excerpt,
'post_type'=>$post_type,
'post_taxonomy'=>$post_taxonomy,
'tags_input'=>$tag,
'post_date'=>$post_date,
'post_author'=>$post_author,
'fujianid'=>$fujianid));
echo '发布成功';
}else{
echo '非法操作['.$hm_action.']';
}
//附件处理
//$filename 附件名称
//$content 标签内容,为空返回首张图片ID
function fileHandle($filesnames, $content = null)
{
global $thumbid;
if (!empty($_FILES[$filesnames.'0']['name'])) {
require_once('./wp-load.php');
require_once('./wp-admin/includes/file.php');
require_once('./wp-admin/includes/image.php');
$i = 0;
while (isset($_FILES[$filesnames.$i])) {
$fujian[$i] = $_FILES[$filesnames.$i];
$filename = $fujian[$i]['name'];
$fileExt=array_pop(explode(".", $filename));
//附件保存格式【时间】
$upFileTime=date("YmdHis");
//更改上传文件的文件名为时间+随机数+后缀
$fujian[$i]['name'] = $upFileTime."-".uniqid().".".$fileExt;
$uploaded_file = wp_handle_upload($fujian[$i], array('test_form' => false));
$content = str_replace("\'".$filename."\'", "\"".$uploaded_file[url]."\"", $content);
$content = str_replace($filename, $uploaded_file[url], $content);
if (isset($uploaded_file['error'])) {
echo "文件上传失败";
wp_die($uploaded_file['error']);
}
$file = $uploaded_file['file'];
$new_file = iconv('GBK', 'UTF-8', $file);
$url = iconv('GBK', 'UTF-8', $uploaded_file['url']);
$type = $uploaded_file['type'];
$attachment = array(
'guid' => $url,
'post_mime_type' => $type,
'post_title' => $filename,
'post_content' => '',
'post_status' => 'inherit'
);
$attach_id = wp_insert_attachment($attachment, $new_file);
if (strpos($fujian[$i]['type'], 'image') !== false) {
if(empty($thumbid) || $filesnames == 'thumb') $thumbid = $attach_id;
$attach_data = wp_generate_attachment_metadata($attach_id, $file);
$attach_data['file'] = iconv('GBK', 'UTF-8', $attach_data['file']);
foreach ($attach_data['sizes'] as $key => $sizes) {
$sizes['file'] = iconv('GBK', 'UTF-8', $sizes['file']);
$attach_data['sizes'][$key]['file'] = $sizes['file'];
}
wp_update_attachment_metadata($attach_id, $attach_data);
}
$i++;
}
}
return $content;
}
function hm_tranlate($text)
{
global $translate_slug;
$pattern = '/[^\x00-\x80]/';
if (preg_match($pattern,$text)) {
$htmlret = substr(md5($text),0,$translate_slug);
} else {
$htmlret = $text;
}
return $htmlret;
}
function hm_print_catogary_list()
{
$cats = get_categories("hierarchical=0&hide_empty=0");
foreach ((array) $cats as $cat) {
echo '<<<'.$cat->cat_ID.'--'.$cat->cat_name.'>>>';
}
}
function hm_get_post_time($post_next="normal")
{
global $time_interval;
global $wpdb;
$time_difference = absint(get_option('gmt_offset')) * 3600;
$tm_now = time()+$time_difference;
if ($post_next=='now') {
$tm=time()+$time_difference;
} else { //if ($post_next=='next')
$tm = time()+$time_difference;
$posts = $wpdb->get_results( "SELECT post_date FROM $wpdb->posts ORDER BY post_date DESC limit 0,1" );
foreach ( $posts as $post ) {
$tm=strtotime($post->post_date);
}
}
return $tm+$time_interval;
}
function hm_publish_pending_post()
{
global $wpdb;
$tm_now = time()+absint(get_option('gmt_offset')) * 3600;
$now_date=date("Y-m-d H:i:s",$tm_now);
$wpdb->get_results( "UPDATE $wpdb->posts set `post_status`='publish' WHERE `post_status`='pending' and `post_date`<'$now_date'" );
}
function hm_add_category($post_category, $post_taxonomy = 'category')
{
if (!function_exists('wp_insert_category')) {include_once "./wp-admin/includes/taxonomy.php";}
global $wpdb,$post_cate_meta,$post_parent_cate,$category_description;
$post_category_new=array();
$post_category_list= array_unique(explode(",", $post_category));
foreach ($post_category_list as $category) {
$cat_ID =$category;
if (!isInteger($cat_ID) || $cat_ID < 1) {
$category = $wpdb->escape($category);
$term = get_term_by('name',$category,$post_taxonomy,'ARRAY_A');
$cat_ID = $term['term_id'];
if($cat_ID == 0){
//检查父分类是否存在和创建父分类->start
if(!empty($post_parent_cate) && $post_parent_cate != '[父分类]')
{
$parent = intval($post_parent_cate);
if($parent == 0){
$post_parent_cate = $wpdb->escape($post_parent_cate);
$term = get_term_by('name',$post_parent_cate,$post_taxonomy,'ARRAY_A');
$cat_ID = $term['term_id'];
if($parent == 0){
$parent = wp_insert_category(array('cat_name'=>$post_parent_cate, 'taxonomy'=>$post_taxonomy));
}
}
$cat_ID = wp_insert_category(array('cat_name'=>$category, 'category_description'=>$category_description, 'category_parent'=>$parent, 'taxonomy'=>$post_taxonomy));
}else{
$cat_ID = wp_insert_category(array('cat_name'=>$category, 'category_description'=>$category_description, 'taxonomy'=>$post_taxonomy));
}
//检查父分类是否存在和创建父分类->end
//定义分类信息->start
if (!empty($post_cate_meta)) {
foreach(array_unique(array_filter($post_cate_meta)) as $key => $value) {
$value = strtoarray($value);
add_term_meta($cat_ID, $key, $value);
}
}
//定义分类信息->end
}
}
array_push($post_category_new, $cat_ID);
}
return $post_category_new;
}
function add_category($post_category, $post_taxonomy = 'category')
{
if (!function_exists('wp_insert_category')) {include_once "./wp-admin/includes/taxonomy.php";}
global $wpdb;
$post_category_new=array();
$post_category_list= array_unique(explode(",", $post_category));
foreach ($post_category_list as $category) {
$cat_ID =$category;
if (!isInteger($cat_ID) || $cat_ID < 1) {
$category = $wpdb->escape($category);
$term = get_term_by('name',$category,$post_taxonomy,'ARRAY_A');
$cat_ID = $term['term_id'];
if($cat_ID == 0){
$cat_ID = wp_insert_category(array('cat_name'=>$category, 'taxonomy'=>$post_taxonomy));
}
}
array_push($post_category_new, $cat_ID);
}
return $post_category_new;
}
function isInteger($value){
return is_numeric($value) && is_int($value+0);
}
function hm_add_author($post_author)
{
global $wpdb,$post_author_default;
$User_ID =intval($post_author);
if ($User_ID == 0) {
$pattern = '/[^\x00-\x80]/';
if (preg_match($pattern,$post_author)) {
$LoginName = substr(md5($post_author),0,10);
} else {
$LoginName = $post_author;
}
$User_ID = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_login = '$LoginName' ORDER BY ID");
$User_ID = $User_ID[0];
if (empty($User_ID)) {
$website = 'http://'.$_SERVER['HTTP_HOST'];
$userdata = array(
'user_login' => "$LoginName",
'first_name' => $post_author,
'user_nicename' => $post_author,
'display_name' => $post_author,
'nickname' => $post_author,
'user_url' => $website,
'role' => 'contributor',
'user_pass' => NULL);
$User_ID = wp_insert_user( $userdata );
}
$post_author = $User_ID;
} else {
$post_author = $post_author_default;
}
return $post_author;
}
function hm_strip_slashes($str)
{
if (get_magic_quotes_gpc()) {return stripslashes($str);} else {return $str;}
}
function checkDatetime($str){$date = strtotime($str);if($date > 31500000){return true;}else{return false;}
}
function formatdate($date) {
$d = date('Y-m-d');
if(strpos($date, 'today') !== false){
return str_replace('today at', $d, $date);
}
if(strpos($date, 'Today') !== false){
return str_replace('Today at', $d, $date);
}
$dd = date('Y-m-d', time()-84600);
if(strpos($date, 'yesterday') !== false){
return str_replace('yesterday at', $d, $date);
}
if(strpos($date, 'Yesterday') !== false){
return str_replace('yesterday at', $d, $date);
}
}
//字符串转换为数组
//字符串的格式必须为 //$str = 'eo_description$$seo_description|||seo_keywords$$seo_keywords|||seo_title$$seo_title';
function strtoarray($str){
if(strpos($str, '|||') !== false){
$str = explode('|||', $str);
if(strpos($str[0],'$$') !== false){
foreach($str as $k => $v){
$v = explode('$$', $v);
$r[$v[0]] = $v[1];
}
$str = $r;
}
}
return $str;
}function hm_do_save_post($post_detail)
{
global $post,$post_author,$post_ping,$post_status,$translate_slug,$post_next,$post_meta,$comment,$commentdate,$commentauthor,$wpdb,$postformat,$post_format,$post_taxonomy_list,$thumbid;
extract($post_detail);
$post_title=trim(hm_strip_slashes($post_title));
$post_name=$post_title;
if ($translate_slug) $post_name=hm_tranlate($post_name);
$post_name=sanitize_title( $post_name);
if ( strlen($post_name) < 2 ) $post_name="";
$post_content=hm_strip_slashes($post_content);
$tags_input=str_replace("|||",",",$tags_input);
if (isset($post_date) && $post_date && checkDatetime($post_date)) {
$tm=strtotime($post_date);
$time_difference = absint(get_option('gmt_offset')) * 3600;
$post_date=date("Y-m-d H:i:s",$tm);
$post_date_gmt = gmdate('Y-m-d H:i:s', $tm-$time_difference);
} else {
$tm=hm_get_post_time($post_next);
$time_difference = absint(get_option('gmt_offset')) * 3600;
$post_date=date("Y-m-d H:i:s",$tm);
$post_date_gmt = gmdate('Y-m-d H:i:s', $tm-$time_difference);
if ($post_status=='next') $post_status='publish';
}
$post_category=hm_add_category($post_category, $post_taxonomy);
$post_data = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_type', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_name','tags_input');
$post_data = add_magic_quotes($post_data);
$postID = wp_insert_post($post_data);
//设定缩略图
set_post_thumbnail( $postID, $thumbid );
//自定义分类方式(taxonomy)
if($post_taxonomy != 'category' && !empty($post_taxonomy)){
wp_set_object_terms($postID, $post_category, $post_taxonomy);
}
//多个自定义分类方式(taxonomy)
if(!empty($post_taxonomy_list)){
foreach($post_taxonomy_list as $k => $v){
$v = strtoarray($v);
if(is_array($v)){
foreach($v as $kk => $vv){
$vv = add_category($vv, $k);
wp_set_object_terms($postID, $vv, $k);
}
}else{
$v = add_category($v,$k);
wp_set_object_terms($postID, $v, $k);
}
}
}
//归档文章形式->start
if(!empty($post_format) && $postformat == true){
if($post_format == 'post-format-image' || $post_format == 'post-format-video' || $post_format == 'post-format-aside'){
wp_set_post_terms($postID, $post_format, 'post_format');
}
}
//归档文章形式->end
//发布自定义栏目
if (!empty($post_meta)) {
foreach($post_meta as $key => $value) {
$ret = add_post_meta($postID,$key,$value,true);
if(!$ret){
delete_post_meta($postID, $key);
add_post_meta($postID,$key,$value,true);
}
}
}
//发布评论->start
if(!empty($comment)){
//格式化评论内容
$comment = str_replace(array("\r\n", "\r", "\n"), "", $comment);
$arraycomment = explode('|||', $comment);
//格式化评论时间
$commentdate = str_replace(array("\r\n", "\r", "\n"), "", $commentdate);
$arraycommentdate = explode('|||', $commentdate);
//格式化评论作者
$commentauthor = str_replace(' ','',$commentauthor);
$commentauthor = str_replace(array("\r\n", "\r", "\n"), "", $commentauthor);
$arraycommentauthor = explode('|||', $commentauthor);
//评论计数
$comment_count = count($arraycomment) -1 ;
//更新文章评论数
$wpdb->get_results("UPDATE $wpdb->posts set `comment_count` = $comment_count WHERE `ID` = $postID");
//写入评论
foreach($arraycommentauthor as $k => $v){
//判断评论时间
if($v != ''){
$format="Y-m-d H:i:s";
$d = formatdate($arraycommentdate[$k]);
$d = strtotime($d);
if($d != ''){
$date = date($format,$d);
$gmtdate = gmdate($format, $d);
}else{
$date = date($format);
$gmtdate = gmdate($format);
}
//写入数据库
$res = $wpdb->get_results("INSERT INTO $wpdb->comments (`comment_post_ID`,`comment_author`,`comment_date`,`comment_date_gmt`,`comment_content`,`user_id`) VALUES ($postID,'$v','$date','$gmtdate','$arraycomment[$k]',1)");
}
}
}
//发布评论->end
// 自定PING,需要再网站后台设置->撰写->更新服务器 下面填写PING地址
if ($post_ping) generic_ping();
}
?>

相关文章:

WordPress:Locoy.php火车头采集

<?php /* 模块参数列表&#xff1a; post_title 必选 标题 post_content 必选 内容 tag 可选 标签 post_category 可选 分类 post_date 可选 时间 post_excerpt 可选 摘要 post_author 可选 作者 category_description 可选 分类信息 post_cate_meta[name] 可选 自定义分…...

C++ 有哪些标准版本

目录 1.主要分为以下几个版本C98&#xff08;ISO/IEC 14882:1998&#xff09; 第一个国际标准C03&#xff08;ISO/IEC 14882:2003&#xff09;小幅度修订C11&#xff08;ISO/IEC 14882:2011&#xff09;一次重大更新C14&#xff08;ISO/IEC 14882:2014&#xff09;增量改进C17&…...

二、MySQL操作命令汇总

文章目录 二、MySQL操作命令汇总1.数据库操作2.表的增删改查2.1 查表2.2 建表给表添加注释假如表已经存在 2.3 删表2.4 查看表结构2.5 改表 3.简单查询3.1 查询单个字段3.2 查询多个字段3.3 查询所有字段3.4 查询结果去重3.5 查询结果排序3.6 查询结果限制条数3.7 查询分组结果…...

编程日志4.28

队列的链表表示代码 #include<iostream> #include<stdexcept> using namespace std; //队列 类的声明 template<typename T>//1.模板声明&#xff0c;表明Queue类是一个通用的模板类&#xff0c;可以用于存储任何类型的元素T class Queue {//2.Queue类的声…...

Qt 中信号与槽(signal-slot)机制支持 多种连接方式(ConnectionType)

Qt 中信号与槽&#xff08;signal-slot&#xff09;机制支持 多种连接方式&#xff08;ConnectionType&#xff09; Qt 中信号与槽&#xff08;signal-slot&#xff09;机制支持 多种连接方式&#xff08;ConnectionType&#xff09;&#xff0c;用于控制信号发出后如何调用槽…...

Python案例实战《手势识别》

目录 1、效果图2、手势识别关键步骤&#xff08;1&#xff09; 导入必要的库&#xff08;2&#xff09;配置 MediaPipe&#xff08;3&#xff09;启动摄像头&#xff08;4&#xff09;设置手指张开判断的距离阈值&#xff08;5&#xff09;计算手指之间的欧几里得距离&#xff…...

NGINX `ngx_http_charset_module` 字符集声明与编码转换

一、模块定位与功能 ngx_http_charset_module 主要提供两大能力&#xff1a; 响应头声明&#xff1a;在 Content-Type 头部自动添加 ; charsetXXX&#xff0c;告知客户端所用字符集。单向编码转换&#xff1a;在 NGINX 层将一种单字节编码&#xff08;如 koi8-r、windows-125…...

进程与线程详细介绍

目录 一 进程概念 二 进程的组成 2.1 PCB 2.2 数据段 2.3 程序段 三 进程的五大特点 四 进程的创建与销毁 五 线程概念 六 线程特征 七 进程与线程的区别与联系 区别 联系 一 进程概念 进程是程序的一次执行过程&#xff0c;是操作系统进行资源分配和调度的基本单位…...

JAVA中ArrayList的解析

gogogo出发喽&#xff01;让我们来认识一下它吧 什么是ArrayList Java 中的 ArrayList 是 Java 集合框架中的重要类&#xff0c;用于实现动态数组 动态数组&#xff1a;可按需自动扩展或缩小&#xff0c;无需手动管理数组大小。比如不断向 ArrayList 添加元素时&#xff0c;…...

【LLM+Code】Devin PromptTools详细解读

Devin 官网&#xff1a;https://devin.ai/ Prompt 大部分篇幅都是tools的直出的description和parameters的一些信息 其他的包含 Communicatework的一些指导Best PracticesInformation HandlingData SecurityResponse Limitationsplanthink You are Devin, a software engi…...

AI应用开发实战分享

一、前言 30年前的IntelWindows互相绑定&#xff0c;让世界被计算机技术重构了一次&#xff0c;有了程序员这个工种。十几年前iPhone、Android前后脚发布&#xff0c;智能手机和移动App互相绑定&#xff0c;引爆了一个长达十几年的移动互联网大跃进时代。而随着人工智能大模型…...

浅聊find_package命令的搜索模式(Search Modes)

背景 find_package应该算是我们使用最多的cmake命令了。但是它是如何找到上游库的.cmake文件的&#xff1f; 根据官方文档&#xff0c;整理下find_package涉及到的搜索模式。 搜索模式 find_package涉及到的搜索模式有两种&#xff1a;模块模式(Module mode)和配置模式(Conf…...

FPGA图像处理(二)-----彩色图像灰度化

由于fpga实现除法相对复杂&#xff0c;故将除法变为乘法再移位。因此每种方法对图像输入数据均分3步进行&#xff0c;极其有效信号打三拍处理。 timescale 1ns / 1ps // // Description: 彩色图像灰度化 // module image_rgb2gray(input wire clk ,input wir…...

Ultralytics中的YOLODataset和BaseDataset

YOLODataset 和 BaseDataset 是 Ultralytics YOLO 框架中用于加载和处理数据集的两个关键类。 YOLODataset类&#xff08;ultralytics/data/dataset.py&#xff09;继承于 BaseDataset类&#xff08;ultralytics/data/base.py&#xff09; BaseDataset() BaseDataset 是一个…...

Mac 使用 Charles代理生成https服务

在Mac电脑上使用Charles软件通过代理生成HTTPS服务&#xff0c;让手机访问电脑的开发地址&#xff0c;可按以下步骤操作&#xff1a; 一、Charles软件设置 安装与启动Charles&#xff1a;从Charles官网下载并安装Charles软件&#xff0c;之后启动它。开启代理服务 点击菜单栏…...

【PostgreSQL】数据库主从库备份与高可用部署

文章目录 一、架构设计原理二、部署清单示例2.1 StatefulSet配置片段2.2 Service配置三、配置详解3.1 主节点postgresql.conf3.2 从节点配置四、初始化流程4.1 创建复制用户4.2 配置pg_hba.conf五、故障转移示例5.1 自动切换脚本5.2 手动提升从节点六、监控与维护6.1 关键监控指…...

ERP进销存系统源码,SaaS模式多租户ERP管理系统,SpringBoot、Vue、UniAPP技术框架

SaaS ERP管理系统源码&#xff0c;覆盖了整个生产企业所有部门的管理&#xff1a;采购、销售、仓库、生产、财务、质量、OA&#xff1a; ERP源码技术架构&#xff1a;SpringBootVueElementUIUniAPP ERP系统功能清单&#xff1a; 流程处理中心&#xff1a;待审批任务、已审批任…...

Decode rpc invocation failed: null -> DecodeableRpcInvocation

DecodeableRpcInvocation 异常情况解决方法 错误警告官方FAQ 异常情况 记录一下Dubbo调用异常 java.util.concurrent.ExecutionException: org.apache.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer. start time: 2025-05-07 22:09:5…...

VAE和Stable Diffusion的关系

文章目录 ✅ 简单回顾&#xff1a;什么是 VAE&#xff1f;&#x1f504; Stable Diffusion 和 VAE 的关系&#xff1a;&#x1f3af; 编码器&#xff1a;&#x1f4a5; 解码器&#xff1a; &#x1f914; 那 Stable Diffusion 本身是 VAE 吗&#xff1f;&#x1f9e0; 简要对比…...

stable Diffusion模型结构

详细描述一下stable Diffusion的推理过程 其实很简单 prompt先经过textencoder tokenizer&#xff0c;embedding 随机生成噪声图片 通过vae encode压缩成潜空间大小 unet with cross attn 去噪 并融合文本信息 # 上面两个信息如何混合 cross-attention sd模型中各种不同的采样器…...

Milvus(16):索引解释

索引是建立在数据之上的附加结构。其内部结构取决于所使用的近似近邻搜索算法。索引可以加快搜索速度&#xff0c;但在搜索过程中会产生额外的预处理时间、空间和 RAM。此外&#xff0c;使用索引通常会降低召回率&#xff08;虽然影响可以忽略不计&#xff0c;但仍然很重要&…...

数字化转型-4A架构之应用架构

系列文章 数字化转型-4A架构&#xff08;业务架构、应用架构、数据架构、技术架构&#xff09;数字化转型-4A架构之业务架构 前言 应用架构AA&#xff08;Application Architecture&#xff09;是规划支撑业务的核心系统与功能模块&#xff0c;实现端到端协同。 一、什么是应…...

中间件-RocketMQ

RocketMQ 基本架构消息模型消费者消费消息模式顺序消息机制延迟消息批量消息事务消息消息重试最佳实践 基本架构 nameServer: 维护broker列表信息&#xff0c;客户端连接时只需要连接nameServer。可配置成集群。 broker&#xff1a;broker分为master和slave&#xff0c;master负…...

AI开发playwright tool提示词

[TASK] 生成一个isModuleElementObject function&#xff0c;若element的qa-test class在对象moduleObj {"qa-test-mycourses-course": "qa-test-mycourses-course-title", "qa-test-discussion-module": "qa-test-discussion-description&…...

《Origin画百图》之带显著性标记的多因子分组柱状图

带显著性标记的多因子分组柱状图 需要数据&#xff1a; 组1&#xff08;大类&#xff09; 组2&#xff08;小类&#xff09; Y数据 Y误差 选中Y数据和Y误差两列数据&#xff0c; 点击绘图--分组图--多因子分组柱状图 数据列就是上一步选择的Y和Y误差&#xff0c; 点击子组…...

邮件发送频率如何设置?尊重文化差异是关键!

一、不同文化背景&#xff0c;邮件频率大不同 1.工作习惯不一样 一些西方国家&#xff0c;美国和欧洲工作时间和个人时间分得很清楚。工作日的上午 9 点到下午 5 点&#xff0c;这期间发邮件&#xff0c;收件人大概率会看也会回。但是在深夜或者周末发邮件容易让收件人觉得你…...

Python 识别图片上标点位置

Python识别图片上标点位置 要识别图片上的标点位置&#xff0c;可以使用Python中的OpenCV库。以下是几种常见的方法&#xff1a; 方法一&#xff1a;使用颜色阈值识别 import cv2 import numpy as np# 读取图片 image cv2.imread(image.jpg)# 转换为HSV颜色空间 hsv cv2.c…...

JDK Version Manager (JVMS)

以下是使用 JDK Version Manager (JVMS) 工具在Windows系统中安装JDK的详细步骤及注意事项&#xff0c;结合多篇搜索结果整理而成&#xff1a; --- 一、安装前准备 1. 下载JVMS - 访问 [GitHub Releases页面](https://github.com/ystyle/jvms/releases) 或镜像地址&#x…...

办公学习 效率提升 超级PDF处理软件 转换批量 本地处理

各位办公小能手们&#xff01;我跟你们说啊&#xff0c;有个软件叫超级PDF&#xff0c;那可真是PDF文件处理界的全能选手&#xff0c;专门解决咱们办公、学习时文档管理的各种难题。接下来我给大家好好唠唠它的厉害之处。 先说说它的核心功能。第一是格式转换&#xff0c;这软件…...

阿里云服务器-centos部署定时同步数据库数据-dbswitch

前言&#xff1a; 本文章介绍通过dbswitch工具实现2个mysql数据库之间实现自动同步数据。 应用场景&#xff1a;公司要求实现正式环境数据库数据自动冷备 dbswitch依赖环境&#xff1a;git ,maven,jdk 方式一&#xff1a; 不需要在服务器中安装git和maven&#xff0c;直接用…...

C++函数栈帧详解

函数栈帧的创建和销毁 在不同的编译器下&#xff0c;函数调用过程中栈帧的创建是略有差异的&#xff0c;具体取决于编译器的实现&#xff01; 且需要注意的是&#xff0c;越高级的编译器越不容易观察到函数栈帧的内部的实现&#xff1b; 关于函数栈帧的维护这里我们要重点介…...

Wireshark抓账号密码

训练内容&#xff1a; 1. 安装Ethereal或者Wireshark&#xff0c;熟悉网络嗅探器的使用方法&#xff1b; 2. 实现浏览器与IIS服务器的ssl安全访问&#xff1b; 3. 利用网络嗅探器截获浏览器访问IIS服务器之间数据包&#xff0c;包括有ssl安全连接&#xff08;https方式&am…...

【hot100】bug指南记录1

之前学了一阵C&#xff0c;还是更熟悉C的语法呀&#xff0c;转Java还有点不适应........ 这个系列纯纯记录自己刷题犯的愚蠢的错误......hhhh&#xff0c;我是人&#xff0c;one 愚蠢的码人...... 巩固巩固基础好吗&#xff1f;&#xff01;编程菜鸟.......hhh&#xff0c;又…...

物联网从HomeAssistant开始

文章目录 一、在树梅派5上安装home-assistant二、接入米家1.对比下趋势2.手动安装插件3.配置方式 三、接入公牛1.手动安装插件2.配置方式 一、在树梅派5上安装home-assistant https://www.home-assistant.io/installation/ https://github.com/home-assistant/operating-syste…...

2025年渗透测试面试题总结-网络安全、Web安全、渗透测试笔试总结(一)(附回答)(题目+回答)

网络安全领域各种资源&#xff0c;学习文档&#xff0c;以及工具分享、前沿信息分享、POC、EXP分享。不定期分享各种好玩的项目及好用的工具&#xff0c;欢迎关注。 网络安全、Web安全、渗透测试笔试总结(一) 1.什么是 WebShell? 2.什么是网络钓鱼&#xff1f; 3.你获取网络…...

C++ set和map系列(关联式容器)的介绍及使用

欢迎来到干货小仓库 "一个好汉三个帮&#xff0c;程序员同样如此" 1.关联式容器 STL中的容器分为两类&#xff0c;序列式容器和关联式容器。 序列式容器&#xff1a;例如STL库中的vector、list和deque、forward_list(C11)等&#xff0c;这些容器统称为序列式容器&…...

C#与Halcon联合编程

一、加载图片 导入并初始化 using HalconDotNet; ho_Image new HObject();需要在引用中导入 halcondotnet.dll 关联句柄 打开新窗口 //创建一个句柄变量 绑定winform 窗口 HTuple winfowFater this.pictureBox1.Handle; //打开新的窗口 HOperatorSet.SetWindowAttr(&qu…...

5.0.4 VisualStateManager(视觉状态管理器)使用说明

在 WPF 中,VisualStateManager(视觉状态管理器)是用于管理控件在不同状态下的外观变化的核心组件。它通过定义视觉状态(如按钮的默认、悬停、按下状态)和状态过渡动画,使控件在不同交互场景下动态切换样式,而无需重写整个控件模板。以下是其核心用法和示例: 1. 基本概…...

onenet连接微信小程序(mqtt协议)

一、关于mqtt协议 mqtt协议常用于物联网&#xff0c;是一种轻量级的消息推送协议。 其中有三个角色&#xff0c;Publisher设备&#xff08;客户端&#xff09;发布主题到服务器&#xff0c;其他的设备通过订阅主题&#xff0c;获取该主题下的消息&#xff0c;Publisher可以发…...

IT需求规格说明书,IT软件系统需求设计文档(DOC)

1 范围 1.1 系统概述 1.2 文档概述 1.3 术语及缩略语 2 引用文档 3 需求 3.1 要求的状态和方式 3.2 系统能力需求 3.3 系统外部接口需求 3.3.1 管理接口 3.3.2 业务接口 3.4 系统内部接口需求 3.5 系统内部数据需求 3.6 适应性需求 3.7 安全性需求 3.8 保密性需…...

探索 DevExpress:构建卓越应用的得力助手

探索 DevExpress&#xff1a;构建卓越应用的得力助手 在当今竞争激烈的软件开发领域&#xff0c;打造高效、美观且功能强大的应用程序是每个开发者的追求。而 DevExpress 作为一款备受瞩目的开发工具&#xff0c;为开发者们提供了实现这一目标的有力支持。在本专栏博客中&…...

康养休闲旅游住宿服务实训室:构建产教融合新标杆

随着健康中国战略的深入实施与银发经济市场的持续扩张&#xff0c;康养休闲旅游作为融合健康管理、文化体验与休闲度假的复合型产业&#xff0c;正迎来前所未有的发展机遇。北京凯禾瑞华科技有限公司依托其在智慧康养领域的技术积淀与产业洞察&#xff0c;创新推出“康养休闲旅…...

Python 程序设计教程:构建您的第一个计算器类

Python 程序设计教程:构建您的第一个计算器类 1. 引言:为什么要学习类? 面向对象编程 (Object-Oriented Programming, OOP) 是一种强大的编程范式,它通过将数据和操作数据的函数(方法)捆绑在一起来组织和结构化代码 1。类 (Class) 是 OOP 的核心概念,不仅在 Python 中…...

深入浅出理解常见的分布式ID解决方案

分布式ID在构建大规模分布式系统时扮演着至关重要的角色&#xff0c;主要用于确保在分布式环境中数据的唯一性和一致性。以下是分布式ID的几个主要作用&#xff1a; 确保唯一性&#xff1a;在分布式系统中&#xff0c;可能有成千上万个实例同时请求ID。分布式ID生成系统能保证即…...

mac 使用 Docker 安装向量数据库Milvus独立版的保姆级别教程

Milvus 特点&#xff1a;开源的云原生向量数据库&#xff0c;支持多种索引类型和GPU加速&#xff0c;能够在亿级向量规模下实现低延迟高吞吐。具有灵活的部署选项和强大的社区支持。 适用场景&#xff1a;适合处理超大规模数据和高性能需求的应用&#xff0c;如图像搜索、推荐…...

Ubuntu日志文件清空的三种方式

清空Ubuntu日志文件可以通过三种方式&#xff1a; 使用命令行清空日志文件&#xff1a;可以使用以下命令清空特定日志文件&#xff0c;例如清空syslog文件&#xff1a; sudo truncate -s 0 /var/log/syslog使用编辑器清空日志文件&#xff1a;可以使用文本编辑器如Nano或Vi来…...

文章记单词 | 第68篇(六级)

一&#xff0c;单词释义 differentiate&#xff1a;英 [ˌdɪfəˈrenʃieɪt] 美 [ˌdɪfəˈrenʃieɪt] &#xff0c;动词&#xff0c;意为 “区分&#xff1b;辨别&#xff1b;使有差别&#xff1b;使不同&#xff1b;表明… 间的差别&#xff1b;构成… 间差别的原因”。…...

Postman最佳平替, API测试工具Bruno实用教程(一):基础篇

序言 在前文【github星标超3万!Postman最强平替Bruno你用了吗?】中,我们介绍了目前目前Github上广受关注的新锐接口测试工具Bruno,给厌倦了Postman必须在线使用限制的同学提供了一个很好的替代选择。 Bruno的核心优势,官网重点给出了如下几点: 承诺开源和可扩展,并且专…...

LabVIEW 与 NI 硬件(PXI, CompactRIO, DAQ, RF, Vision)的深度研究与未来发展趋势-分析报告

LabVIEW 与 NI 硬件&#xff08;PXI, CompactRIO, DAQ, RF, Vision&#xff09;的深度研究与未来发展趋势 引言 本报告旨在对 National Instruments (NI) 的 LabVIEW 软件平台及其核心硬件产品线&#xff0c;包括 PXI、CompactRIO、DAQ、RF 和 Vision 系列&#xff0c;进行深…...

上海雏鸟科技再赴越南,助力10518架无人机刷新吉尼斯记录

近日&#xff0c;上海雏鸟科技携手深圳大漠大、河南豆丁智能在越南胡志明市&#xff0c;使用10518架无人机刷新了“最多无人机同时起飞”的世界吉尼斯记录。本次无人机灯光秀表演以越南南部解放50周年为背景突出了越南历史与民族文化的主题&#xff0c;是一场融合了技术与艺术的…...