无情编码机器
vue 3.0 +axios 跨域情况下无法携带cookie?
vue 3.0 +axios 跨域情况下无法携带cookie
cooKie 是本地写入缓存的
axios已设置withCredentials=true;
const $axios = axios.create({
baseURL: url,
withCredentials: true,
crossDomain: true
})
// 发起跨域请求
$axios.get('/picture/upload', {
headers: {
'Content-Type': 'application/json'
}
}).then(response => {
console.log(response.data)
}).catch(error => {
console.error(error)
})
后端也加了
access-control-allow-credentials: true
access-control-allow-origin: http://localhost:8080
发起请求时 查看请求头还是无法携带cookie
无情编码机器
请问什么是gpui?
我在看最新的开发者IDE: Zed的时候,
发现它有一个标签:gpui
请问"gpui" (https://link.segmentfault.com/?enc=ghiv%2BaTy%2B5s1bYuQbXqCmQ%3D%3D.Ddt6dJj4GqFL5BodI%2Fcpho4ODZHQHcymXDFmdemTTeA%3D)是什么?
和 GPU 有关系吗?
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250113/f73033eea74045179168ef90d05ba565.png)
无情编码机器
华为官网鼠标悬浮图片,右侧放大功能怎么做的?
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250112/e2f6b9d8dc14379d7e7d1f371dc30dfb.png)
tb放大镜
.small-box {
position: relative;
height: 300px;
}
.small-pic {
width: auto;
height: 300px;
}
.mask {
width: 526px;
position: absolute;
top: 0;
left: 0;
z-index: 1;
height: 100%;
cursor: crosshair;
}
.rect {
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
opacity: .5;
background-color: red;
z-index: 0;
}
.big-box {
display: inline-block;
position: relative;
width: 266px;
height:266px;
border: 1px solid red;
overflow: hidden;
}
.big-pic {
position: absolute;
width: 1400px;
height: 798px;
top: 0;
left: 0;
}
.big-pic2{
display: inline-block;
width: 266px;
height:266px;
background-size: auto 798px;
background-image: url("https://ts1.cn.mm.bing.net/th/id/R-C.466bb61cd7cf4e8b7d9cdf645add1d6e?rik=YRZKRLNWLutoZA&riu=http%3a%2f%2f222.186.12.239%3a10010%2fwmxs_161205%2f002.jpg&ehk=WEy01YhyfNzzQNe1oIqxwgbTnzY7dMfmZZHkqpZB5WI%3d&risl=&pid=ImgRaw&r=0");
background-position: 0 0;
}
window.onload = function () {
var mask = document.getElementsByClassName('mask')[0];
//为什么要用mask呢?不直接用选中small-pic。
//如果直接选择图片标签来绑定下面的mouseover事件,图片会一直闪烁!所以我们得给他一个和图片一样大小的遮罩层
var rect = document.getElementsByClassName('rect')[0];
var bPic = document.getElementsByClassName("big-pic")[0];
var bPic2 = document.getElementsByClassName("big-pic2")[0];
mask.addEventListener('mousemove', throttle(magnifier,100))
function magnifier(e){
//方块的left top在你的鼠标的左上方(网页左上角是原点),因此是减去一个方块的一半。
var x = e.offsetX - rect.offsetWidth / 2;
var y = e.offsetY - rect.offsetHeight / 2;
//极端情况,也就是当你的鼠标上的方块到四个边的边缘的时候。
if (x mask.offsetWidth - rect.offsetWidth) {
x = mask.offsetWidth - rect.offsetWidth;
}
if (y > mask.offsetHeight - rect.offsetHeight) {
y = mask.offsetHeight - rect.offsetHeight;
}
//方块定位
rect.style.display="block";
rect.style.left = x + 'px';
rect.style.top = y + 'px';
//第一种方法:需要注意的是这里的left 和 top得反过来,你鼠标在小图上往下移的时候,对应的大图其实是往上移的。
//所以:大图上的left = -小图上的left * 他们的缩放倍率
bPic.style.display = "block";
bPic.style.left = -x * bPic.offsetWidth / mask.offsetWidth + 'px';
bPic.style.top = -y * bPic.offsetHeight / mask.offsetHeight + 'px';
//第二种方法,这里需要注意 backgroundPosition的值是从0 - 100%的(得用百分比表示);
//需要注意的是何时为百分百,从上面的极端情况判定我们可以知道
//x 是从0 到 mask.offsetWidth - rect.offsetWidth;
//因此这就是0 - 100%;y同理
bPic2.style.display = "block";
bPic2.style.backgroundPosition =`${x/(mask.offsetWidth - rect.offsetWidth)*100}% ${y/(mask.offsetHeight- rect.offsetHeight)*100}%`;
}
mask.addEventListener('mouseout',function(){
rect.style.display = "none";
bPic.style.display = "none";
bPic2.style.display = "none";
})
//函数节流
function throttle(fn, delay) {
var pre = new Date().getTime();
return function () {
var context = this;
var args = arguments;
var now = new Date().getTime();
if (now - pre > delay) {
fn.apply(this,arguments);
}
}
}
}
````
无情编码机器
想实现windows自动安装给定软件?
问题描述
题主电脑软件比较多,考虑到后面换电脑的需要,想做一个windows自动安装软件(给定安装包)的脚本,因为对脚本并不熟悉,希望大佬们给点思路
补充:额,考虑到强迫症,如果能更改安装位置就更好了
无情编码机器
数据库统计符合条件数据优化?
场景:在一个业务流程中需要去mysql表中距离现在超过三个月的数据条数,但是如果在表格中数据较多的情况下,通过 select
count(*)方法来进行统计是比较耗时的操作,同时也会影响数据的插入。
想请问一下各位前辈,有没有比较好的方案,来实现这样的功能?
我现在想的是建立一张额外的表去记录扫描的起始范围,然后通过定时器,定时移动起始范围,扫描统计。
无情编码机器
React 路由插件 reactrouter 的路由匹配问题:空路由为什么匹配不到?
最终解决方案是:将默认路由放在最下面并添加 "index" 属性
{
path: "/",
index: true,
lazy: () => import("./Page/Home"),
}
无情编码机器
vue 实现input框的宽度自适应?
vue 如何实现input框的宽度自适应?
无情编码机器
报错了 报错了??
import mysql.connector
# 连接到数据库
conn = mysql.connector.connect(
host="主机名或IP地址",
user="数据库用户名",
password="数据库密码",
database="数据库名"
)
# 创建一个游标对象
mycursor = conn.cursor()
# 定义查询字符串
query_str = "SELECT yu, rt FROM tablename"
try:
mycursor.execute(query_str)
results = mycursor.fetchall()
for row in results:
yu, rt = row
print(f"yu: {yu}, rt: {rt}")
except Exception as e:
print(f"An error occurred: {e}")
finally:
# 关闭游标和连接
mycursor.close()
conn.close()
无情编码机器
mysql8创建用户并授权之后仍无法远程连接的原因?
两台服务器:
服务器A, 192.168.111.111
服务器B, 192.168.111.113
均装有mysql8, 均未开启防火墙,
服务器A msyql的配置文件 也没有bind-address什么的配置
需要从服务器B,远程连接服务器A,并对数据库test进行备份操作,
在服务器A中,已经使用mysql8创建了用户并授权如下:
$ CREATE USER 'test1'@'192.168.111.113' IDENTIFIED BY 'abcABC123';
$ GRANT SELECT ON test.* to 'test1'@'192.168.111.113';
$ FLUSH PRIVILEGES;
在服务器B中,连接
$ mysql -h 192.168.111.111 -utest1 -p
password: abcABC123
然后提示:
ERROR 1130 (HY000): Host '192.168.111.111' is not allowed to connect to this MySQL server
求解
无情编码机器
为什么一个 logger 的 handlers 是空的,但是还是可以往标准输出输出内容呢?
handler 确实不是必须的
from nameko.timer import timer
from nameko.runners import _log
import logging
logging.basicConfig(level=logging.INFO, format='%(message)s')
_log.info('哈哈哈哈')
print(_log.handlers)
改成上面那样,就 ok 了
(ideaboom) ╭─ponponon@MBP13ARM ~/Desktop/code/me/ideaboom ‹feature/svddb*›
╰─➤ python -u "/Users/ponponon/Desktop/code/me/ideaboom/101.py"
哈哈哈哈
[]
这也是 nameko
的实现方式:"https://github.com/nameko/nameko/blob/master/nameko/cli/run.py" (https://link.segmentfault.com/?enc=%2B49QEGVthNfaCeTdv3fFkA%3D%3D.wfNr4tD9%2FICxkSS9bltoZBIiEvYpSQcpY%2FF6tGP4zvq1Q%2Bn4gIydw0b5Eowh47BRj8WhDdkMO9KXsMGG5TG%2Bzg%3D%3D)
无情编码机器
怎么把这个data1数组改造成data2数组,相当于过滤其中isShow=false的对象?
用filter过滤,再加个递归就行了
function filterData(data){
return data.filter(item => {
if(item.isShow) {
return true;
} else if(item.children && item.children.length) {
const res = filterData(item.children);
if(res.length){
item.children = res;
return true;
}
}
return false;
})
}
无情编码机器
sql 中like有特殊字符\ “ 为何查不出结果?
后面我重新试了下,可以写成下面的样子,其中前面的\最0-7个,对查询结果没啥影响,后面的可以4-7也能查出结果,很是神奇。
SELECT * from task where column_a LIKE '%\\\\"totalCount\\\\":false%'
无情编码机器
vue3如何将异步获取的后端返回值在前端页面显示?
methods: {async searchLocation() {
try {
const response = await axios.get('http://localhost:29999/selectLocationByNumber/'+this.inputValue);
console.log(response.data);
this.number = response.data.number;
this.location = response.data.location;
} catch (error) {
// 处理请求错误
console.error('Error fetching data:', error);
}
},}
export default {data() {
return {number:'',
location:'',}
}}
{{ number }}
{{ location }}
异步方法向后端发送请求,得到返回值response,number和location在页面上显示不出来?不会vue
无情编码机器
前端开发,windows下如何调试safari兼容问题?
Windows 版 Safari 浏览器 5.1.7 是适用于 Windows 的最后一个版本,而且现已过时。
现在video在safari下无法正常显示,有兼容问题。
请问windows下如何调试safari浏览器兼容问题?
无情编码机器
vue兄弟组件通信?
前提是在原来老代码的基础上,保证不影响其他功能。
一个页面多个表单组件来回切换,数据相互关联,怎么优雅的在父页面提交完整的数据,子组件的修改的数据,能够双向同步父组件?
在原代码基础上很容易扩充字段。
无情编码机器
js如何获取input中target下的value字符串?
"f38a720158a7ca3fefb096c8f36793e.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241202/5c677016aeb3c2f409c406b28a9a0076.png)
"d70a6209e0484a1e3b8dc56b322dd13.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241202/b4ab68af7825ac2ff11923030ebe15e0.png)
无情编码机器
vue3 props 是对象的情况如何变为响应式?
在 "render function" 外部访问 props 的值,还想保留响应式的话,需要用 "computed" 来处理
const src = computed(() => props.decorateConfig.src)
无情编码机器
使用node更改req的参数,为什么多了一个中间件就拿不到了?
multer源码:
single function:
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241128/ca30b8c3dc65e6858ecb3ef41fbee5d4.png)
_makeMiddleware function:
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241128/ea26b9df4dbe9078a951f88b16fe22d2.png)
makeMiddleware function:
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241128/0bb111ab40ad2e2edc29718186758d4d.png)
所以在"upload.single('avatar')"运行之前放入到body中的任何内容都会在这里被清空.
解决办法的话,我觉得可以在single和controller中间再跑一个中间件,这个中间件重新解析token,然后把你需要的数据放到body里面。
无情编码机器
求解一个警告?
export default {
// ...
methods: {
handleSearch(value) {
// 处理搜索逻辑
},
// ...
}
// ...
};
无情编码机器
forge viewer部件异常移动应该如何解决?
我的本意是想让整块部件往x轴方向移动,但是当我获取他们的位置的时候,部分部件就会偏移原来的位置,移动到异常的地方
以下是我的部分代码:
这个是初始化代码
/* 连接入口 */
// 设置模型交互的方法
const setupModelInteraction = () => {
tree = viewer.model.getData().instanceTree;
const partNamesList = {
basePart: ["T1"],
Part: ["X1", "X2", "X3", "X5", "X6", "X12", "X13", "Z1", "Z2"]
}
const nodeIds = getModelNodeIds(partNamesList);
baseRodPivot = createPivot(nodeIds.T1NodeId);
// 获取除basePart外的所有部件名称
const nonBasePartNames = Object.keys(partNamesList)
.filter(key => key !== 'basePart') // 排除基础部件
.flatMap(key => partNamesList[key]); // 展平名称数组
// 为每个非基础部件创建辅助对象
const helperObjects = nonBasePartNames.map(name => createHelper(nodeIds[`${name}NodeId`], baseRodPivot.position));
//添加非基础件部件
addHelpersToPivot(baseRodPivot, helperObjects);
initializeRotation(helperObjects, nodeIds);
};
/* 运动入口 */
// 初始化旋转的方法,接收辅助对象和节点ID对象作为参数
const initializeRotation = (helperObjects, nodeIds) => {
const partSuffixes = {
linePart: {
x: ["X1", "X2", "X3", "X5", "X6", "X12", "X13"],
z: ["Z1", "Z2"]
},
};
// 获取辅助对象和节点ID的对应关系
const helperNodeIdPairs = getHelperNodeIdPairs(partSuffixes, helperObjects, nodeIds);
console.log(helperNodeIdPairs)
startRotationAnimation(helperNodeIdPairs);
};
上下文:(就是在applyHelpersTransformations这个函数之后就会出现问题)
// 应用辅助对象变换的方法,接收辅助对象和节点ID对象作为参数
const applyHelpersTransformations = (helperNodeIdPairs) => {
for (const pair of helperNodeIdPairs) {
assignTransformations(pair.helper, pair.id);
}
};
// 动画辅助对象的方法,接收一个包含基准点、辅助对象、X轴偏移量、Z轴偏移量的对象作为参数
const animateHelpers = ({ helperNodeIdPairs, xOffsetAmount, zOffsetAmount }) => {
const render = () => {
const positions = calculateHelpersNewPositions(helperNodeIdPairs, xOffsetAmount, zOffsetAmount);
updateHelpersPositions(helperNodeIdPairs, positions);
applyHelpersTransformations(helperNodeIdPairs);
viewer.impl.sceneUpdated(true);
requestAnimationFrame(render);
};
render();
};
核心代码:
// 辅助函数
const assignTransformations = (refererence_dummy, nodeId) => {
refererence_dummy.parent.updateMatrixWorld();
const position = new THREE.Vector3();
const rotation = new THREE.Quaternion();
const scale = new THREE.Vector3();
refererence_dummy.matrixWorld.decompose(position, rotation, scale);
tree.enumNodeFragments(nodeId, (frag) => {
const fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
fragProxy.getAnimTransform();
fragProxy.position = position;
fragProxy.quaternion = rotation;
fragProxy.updateAnimTransform();
});
}
const findNodeIdbyName = (name) => {
let nodeList = Object.values(tree.nodeAccess.dbIdToIndex);
for (let i = 1, len = nodeList.length; i {
let result = {
fragId: [],
matrix: [],
};
tree.enumNodeFragments(nodeId, (frag) => {
let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
let matrix = new THREE.Matrix4();
fragProxy.getWorldMatrix(matrix);
result.fragId.push(frag);
result.matrix.push(matrix);
});
return result;
}
我想要知道fusion360建出来的模型应该如何获取他们的位置,为什么这个代码获取出来的部分位置是错误的
无情编码机器
linux 管道命令删除不掉?
xargs 是默认是空白分隔的。你这些路径里都有空格,所以都被拆成多个了。
Linux 下, find 可以以 \0 分隔(-print0),xargs 也可以(-0)。两者配合着用就没这个问题。
Mac 的 find 不一样,自己去查一下吧。
无情编码机器
amh使用时如何防止恶意绑定主机ip ?
安装amh后默认就有一个ip的主机,正常所有非绑定的域名都会访问到这个主机的,你给这个主机加规则就行,如
return 400;
或
return 444;
如果你删除了这个主机就加回来,
以ip为名添加虚拟主机,lnmp主机还有一『默认主机』选项,你都可以勾选上。
其它mysql、ssl的没什么区别,正常都在面板使用。
无情编码机器
charles抓包安卓手机网页,总是有提示,且部分网页无法访问?
https 本来就不能抓包,只会给你域名,你访问http的网站,就能抓到,你可以试试
无情编码机器
Java 导出Excel时如何添加注释?
可以通过GcExcel,在导出Excel的时候,批量添加注释。
"注释 - GcExcel 中文文档Java版 | 服务端高性能表格组件 - 葡萄城" (https://link.segmentfault.com/?enc=DROYIeCPlJNFemWCoDEP3w%3D%3D.K3SC00GsoA5JsEs%2B67lqPgtY%2FDQPxMvXD2wiSBlzeJIHwgM%2BkV8F0gaf%2Fs732z0rV6XSV%2B0J1Leditp2j0uB4%2B835CN2Wz7STZiXrxTUAqRz9ew6QHeTwZ%2FSc19uZ0Z5)
public void AddComments() {
Workbook wb = new Workbook();
IWorksheet worksheet = wb.getWorksheets().get(0);
worksheet.getRange("C3").addComment("C3 区域的注释");
worksheet.getRange("C4").addComment("C4 区域的注释");
worksheet.getRange("C5").addComment("C5 区域的注释");
wb.save("output/AddComments.xlsx");
}
结果如下:
"image.png" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241029/442d6ed875e69517a58f9ad87b918517.png)
无情编码机器
java11的新特性有哪些
Java 11 新特性概览
Java 11 是 Java 语言的重大更新,带来了许多新特性和改进。以下是 Java 11 的一些主要新特性:
1. 局部变量类型推断
- 描述:使用 "var" 关键字来声明局部变量,编译器会自动推断变量的类型。
- 示例:var list = new ArrayList();
var stream = list.stream();
2. 新的 HTTP 客户端 API
- 描述:引入了一个新的 HTTP 客户端 API,支持 HTTP/2 和 WebSocket。
- 示例:HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://example.com"))
.build();
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(System.out::println)
.join();
3. 标准化的 JSON 处理
- 描述:提供了一套标准的 JSON 处理 API。
- 示例:import java.util.*;
import javax.json.*;
JsonArray array = Json.createArrayBuilder()
.add("Hello")
.add("World")
.build();
System.out.println(array.toString());
4. 支持单文件源码程序
- 描述:可以直接运行单个 Java 源文件,无需编译。
- 示例:java HelloWorld.java
其中 "HelloWorld.java" 包含 "public static void main(String[] args)" 方法。
5. 增强的 ZGC 和 Shenandoah GC
- 描述:改进了 ZGC(Z Garbage Collector)和 Shenandoah GC,使其更适合生产环境,减少停顿时间。
- 示例:在 JVM 启动参数中启用 ZGC:java -XX:+UseZGC -Xmx4G -Xms4G MyApplication
6. 模块化系统改进
- 描述:进一步改进了 Java 9 引入的模块化系统,增加了对模块的更多支持。
- 示例:在模块描述文件 "module-info.java" 中定义模块:module my.module {
requires java.logging;
exports com.example;
}
7. Flight Recorder 和 Mission Control
- 描述:引入了 Flight Recorder 用于收集诊断和性能数据,Mission Control 用于分析这些数据。
- 示例:启用 Flight Recorder:java -XX:StartFlightRecording:duration=60s,filename=myrecording.jfr MyApplication
8. 废弃 Nashorn JavaScript 引擎
- 描述:Nashorn JavaScript 引擎在 Java 11 中被标记为废弃,推荐使用其他 JavaScript 引擎。
- 示例:使用 Nashorn(已废弃):ScriptEngine nashorn = new ScriptEngineManager().getEngineByName("nashorn");
nashorn.eval("print('Hello, World')");
9. Epsilon GC
- 描述:引入了一个新的垃圾收集器 Epsilon,其主要目的是进行性能测试和内存泄漏检测。
- 示例:启用 Epsilon GC:java -XX:+UseEpsilonGC -Xmx1G MyApplication
10. Unicode 10 支持
- 描述:更新了 Unicode 支持,包括新的字符和符号。
- 示例:使用新的 Unicode 字符:System.out.println("u1F600"); // 输出 😄
这些新特性和改进使得 Java 11 在性能、易用性和功能上都得到了显著提升。
无情编码机器
ThinkPHP6 无法获取到 URL 参数问题?
thinkphp6 无法获取到url里的参数 用的是docker 部署的 nginx +php 7.4.33 在我的测试环境没有问题
放到另一个服务器里就获取不到参数了
伪静态是这个:
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
测试了是可以访问到index.php的 而且用index.php?a=b这样是可以获取到参数a的 但是我用index.php?s=aa就获取不到了
无情编码机器
抱歉。安装 AMH 失败了?
👍以破案,没有所说的128小内存可以安装AMH,换了一个256M的就成功安装上了,(进程被Killed掉了,看服务器内存是否用满,与是否全新的系统安装amh)说明确实是内存不够导致无法安装成功!!!
虚拟化 LXC
架构 Arm64 / Amd64
核心 1C
内存 256M
磁盘 3G 👌
——————————————————————————————————
Libraries have been installed in:
/usr/local/libiconv-1.16/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
---------------------------------------------------------------------- make[2]: Leaving directory '/tmp/libiconv-1.16/libcharset/lib'
/bin/bash ./build-aux/mkinstalldirs /usr/local/libiconv-1.16/include
/bin/install -c -m 644 include/libcharset.h /usr/local/libiconv-1.16/include/libcharset.h
/bin/install -c -m 644 include/localcharset.h.inst /usr/local/libiconv-1.16/include/localcharset.h
make[1]: Leaving directory '/tmp/libiconv-1.16/libcharset'
cd lib && make install prefix='/usr/local/libiconv-1.16' exec_prefix='/usr/local/libiconv-1.16' libdir='/usr/local/libiconv-1.16/lib'
make[1]: Entering directory '/tmp/libiconv-1.16/lib'
/bin/bash ../libtool --mode=compile gcc -I. -I. -I../include -I./../include -I.. -I./.. -g -O2 -fvisibility=hidden -DLIBDIR=\"/usr/local/libiconv-1.16/lib\" -DBUILDING_LIBICONV -DBUILDING_DLL -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"/usr/local/libiconv-1.16/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libiconv_set_relocation_prefix -Drelocate=libiconv_relocate -Drelocate2=libiconv_relocate2 -DHAVE_CONFIG_H -c ./iconv.c
libtool: compile: gcc -I. -I. -I../include -I./../include -I.. -I./.. -g -O2 -fvisibility=hidden -DLIBDIR=\"/usr/local/libiconv-1.16/lib\" -DBUILDING_LIBICONV -DBUILDING_DLL -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"/usr/local/libiconv-1.16/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libiconv_set_relocation_prefix -Drelocate=libiconv_relocate -Drelocate2=libiconv_relocate2 -DHAVE_CONFIG_H -c ./iconv.c -fPIC -DPIC -o .libs/iconv.o
gcc: fatal error: Killed signal terminated program cc1
compilation terminated.
make[1]: *** [Makefile:82: iconv.lo] Error 1
make: *** [Makefile:52: install] Error 2
make[1]: Leaving directory '/tmp/libiconv-1.16/lib'
[Notice] libiconv-1.16 is not installed.
==========================================================================
抱歉。安装 AMH 失败了,
如有需要帮助安装,请联系我们: https://amh.sh/bbs/forum.htm
==========================================================================
无情编码机器
使用@antv/x6,遇到节点里的文字超出宽度该怎么办?
https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241014/36c0dda36655c41b8e1ee088a55df4e9.png
import { Graph } from "@antv/x6";
const data = {
// 节点
nodes: [
{
id: "node1", // String,可选,节点的唯一标识
x: 40, // Number,必选,节点位置的 x 值
y: 40, // Number,必选,节点位置的 y 值
width: 80, // Number,可选,节点大小的 width 值
height: 40, // Number,可选,节点大小的 height 值
label: "hellohellohellohellohellohellohellohellohello", // String,节点标签
},
{
id: "node2", // String,节点的唯一标识
shape: "ellipse", // 使用 ellipse 渲染
x: 40, // Number,必选,节点位置的 x 值
y: 160, // Number,必选,节点位置的 y 值
width: 80, // Number,可选,节点大小的 width 值
height: 40, // Number,可选,节点大小的 height 值
label: "world" // String,节点标签
}
],
// 边
edges: [
{
source: "node1", // String,必须,起始节点 id
target: "node2" // String,必须,目标节点 id
}
]
};
export default {
name: "HelloWorld",
props: {
msg: String
},
data() {
return {};
},
mounted() {
const graph = new Graph({
container: document.getElementById("container"),
width: 800,
height: 600,
background: {
color: "#fffbe6" // 设置画布背景颜色
},
grid: {
size: 10, // 网格大小 10px
visible: true // 渲染网格背景
}
});
graph.fromJSON(data);
}
};
label: "hellohellohellohellohellohellohellohellohello", // String,节点标签
这个会超出id: "node1", // String,可选,节点的唯一标识这个宽,我又不想截断这个字符串,有没有添加 类似 popover这样的功能
无情编码机器
springboot多线程事务对于大数据量插入更新是否有性能提升?
业务需求需要先进行远程请求数据——> 数据筛选清洗组装->
同库不同表间删除、更新->插入数据,如出现异常则进行回滚,现在对于数据筛选清洗组装采用多线程操作,后面的对数据的操作采用同步方式,虽然可以保持事务,但是感觉入库有点慢了,测试数据3w条,表结构还好不是太复杂,大概6mb多的sql语句,入库需要4s,感觉有点慢了,能不能使用多线程事务进行优化
?这个3w只是往一张表中插,后面还有比这个数据量更大的往其他表插,就现在的性能来说感觉不太够啊。
多线程数据库事务操作,最重要的是事务一致,所以如何在保证事务的情况下能够提高效率,有没有示例demo推荐的?或者有更好的方案?
无情编码机器
python flask uwsgi结合不使用nginx出现的问题?
当我使用 Flask 结合 uWSGI 在服务器上以 HTTP 模式启动部署时,如果我通过科学上网访问服务器的公网 IP
加上端口,我可能会遇到网络阻断和高延迟的问题,导致无法正常访问。然而,当我关闭科学上网并使用服务器的真实 IP 地址时,访问就正常了。另外一种解决方法是使用
Nginx 反向代理端口,这样就不会受到科学上网的影响。不清楚这种方法的原理是什么。
无情编码机器
自己下载的maven引入报错问题?
你本地的 repository 也要有相同包名的 文件夹路径,还需要相关的pom文件才行的,只是一个jar包 不行的。
而且你如果是指单纯想用这个jar包,还有个 systemPath可以设置的
xx
xx
xx
system
xxx.jar
无情编码机器
如何在maccms10上解决后台404错误?
从宝塔换到AMH要注意删除宝塔在你网站根目录创建的.ini配置文件。
不删除的话,所有访问php文件都会404。
有很多从BT换到AMH的都是这个原因,
其它原因404的就要排查访问的文件是否存在,404是找不到文件。
无情编码机器
如何在Vite项目中从Vue 3.2升级到Vue 3.4?
vite项目中如何把vue3.2版本升级到vue3.4版本https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241011/100c2c2fb1215902748b5759a7f6dc91.png
无情编码机器
elementui 父组件用子组件的ref方法怎么弄?
老师们好,我用el-form封装了一个组件, 父组件想调用这个组件的的this.$refs['formRef'].resetFields() 方法,
测试了一些方法都不好用想请老师们给一个思路,谢谢啦。这个环境是用vue2.
下面是封装子组件的代码:
{{ o.label }}
{{ o.label }}
export default {
name: 'EForm',
// components: { EInput },
props: {
formData: {
type: Object,
required: true,
default: () => {}
},
formModel: {
type: Object,
required: true,
default: () => {}
},
formRules: {
type: Object,
required: false,
default: () => {}
}
},
data() {
return {}
},
mounted() {
// console.log('this.ref: ', this.$refs)
// const entries = Object.entries(this.$refs['formRef'])
// for (const [key, value] of entries) {
// this[key] = value
// }
},
methods: {
childMethod() {
// this.$refs
this.$refs['formRef'].resetFields()
},
validateFormItem() {
this.$refs['formRef'].validate(valid => {
this.$emit('validateForm', valid, this._props.formModel)
})
}
}
}
无情编码机器
sql server不同用户得到的内容不同?
我现在有一个列表的sql server
的数据库表,然后有一个用户提交的数据库表,想要实现的话就是,用户提交完毕后给第一张表的一个字段变为true,就是不同用户看到的列表字段不一样,只有提交表单后的用户,他的列表特定字段才会变为true,用户未提交就为false
想要实现的话就是,用户提交完毕后给第一张表的一个字段变为true,就是不同用户看到的列表字段不一样,只有提交表单后的用户,他的列表特定字段才会变为true,用户未提交就为false
无情编码机器
关于TS类型推导中结果中,函数参数的类型问题?
关于TS类型推导中结果中,函数参数的类型问题?
链接在这里:"https://tsplay.dev/mxE51W" (https://link.segmentfault.com/?enc=vwEWE1aw4yxy3bXKv8pMlg%3D%3D.YtARn0RiirMxN%2FTZoxHn0aJVJ3g4aoIPa6pnUQzOIZc%3D)
type ClassNamesUtil = (value: string) => string;
type ClassNames = (value: number) => string;
interface WraperProps {
styles: T;
cx: T extends string ? ClassNamesUtil : ClassNames;
}
function action({ styles, cx }: WraperProps) {
console.log(styles, cx('a'));
}
问题是:
1. 为什么在"action"中,调用"cx('a')"的时候,参数类型是"never"呢?
2. 如何让"cx"根据传入的泛型"T"来决定接受的类型呢?
"281707912317_.pic.jpg" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241010/78cd901e4b46a1d2ddc326fc0fb0c4dc.png)
无情编码机器
如何在.js文件夹中增加路由跳转及弹窗?
// @/route/index.js
const router = new VueRouter({
mode: 'history',
base: '/',
routes: [
{
path: 'somewhere',
component: somewhere,
}
],
})
export default router
import router from '@/route'
export function goSomewhere() {
router.push('/somewhere')
}
***
如果是想加弹窗的话可以写一个挂载方法,拿我正在用的举例:
import Vue from 'vue'
export const cache = new Set()
export default function useDialog(component) {
const div = document.createElement('div')
const el = document.createElement('div')
const id = 'dialog-' + Math.random()
div.appendChild(el)
document.body.appendChild(div)
const ComponentConstructor = Vue.extend(component)
return (propsData = {}, parent = undefined) => {
let instance = new ComponentConstructor({
propsData,
parent,
}).$mount(el)
const destroyDialog = () => {
if (cache.has(id)) return
if (instance && div.parentNode) {
cache.add(id)
instance.visible = false
// 在关闭动画执行完毕后卸载组件
setTimeout(() => {
cache.delete(id)
instance.$destroy()
instance = null
div.parentNode && div.parentNode.removeChild(div)
}, 250)
}
}
// visible控制
if (instance.visible !== undefined) {
// 支持sync/v-model
instance.$watch('visible', (val) => {
!val && destroyDialog()
})
Vue.nextTick(() => (instance.visible = true))
}
return new Promise((resolve, reject) => {
// 组件内 emit done 事件表示确认
instance.$once('done', (data) => {
destroyDialog()
resolve(data)
})
// 组件内 emit cancel 事件表示取消
instance.$once('cancel', (data) => {
destroyDialog()
reject(data)
})
})
}
}
使用用法:
import AddGroupDialog from './AddGroupDialog.vue'
function handleAdd() {
useDialog(AddGroupDialog)({
// ...props
}).then(() => {
// onDone
})
},
弹窗组件:
取消
确定
import router from '@/router'
export default {
name: 'AddGroupDialog',
data() {
return {
visible: false,
}
},
methods: {
submit() {
router.push('somewhere')
},
close() {
this.visible = false
},
},
}
无情编码机器
如何正确使用 Umi Max 中的 useModel?
umi max如何使用useModel?
我使用了ant-design-pro脚手架,在里面使用了useModel,创建了一个 文件名为 useTestModel.ts文件,目录结构为
./src/pages/System/useTestModel
我在另一个文件里使用useModel,提示找不到此文件
./src/pages/System/useTestModel.ts
import { useState } from 'react';
export default function useTestModel() {
const [counter, setCounter] = useState(0);
const increment = () => {
setCounter((c) => c + 1)
};
const decrement = () => {
setCounter((c) => c - 1)
};
return { counter, increment, decrement };
}
在其他文件中使用
import { useModel } from '@umijs/max';
const { counter, increment, decrement } = useModel('useTestModel');
return {counter}
页面一直提示找不到 counter
我看umi max的文档写的也不清不楚的,应该怎么使用呢?
无情编码机器
vue3+vite打包的app在galaxy打开白屏显示(只在三星手机上)有遇到吗?
手机的Android版本是多少,其它手机打开正常吗?
无情编码机器
子类为什么能通过继承父类中的setName方法给自己设置父类中被private修饰的name属性?
其实你只要理解一句话就很好理解:
"子类实例既是子类类型,又是父类类型"
这个子类实例没有继承自父类的private属性,这是对的,但是它自己同时又是父类类型呀,所以其实它是有这个属性的,只不过是属于父类类型的,public方法继承自父类类型就不用多说了,它调用这个方法实际上修改的是它属于父类类型这一面的私有属性
无情编码机器
为什么对原始数据排序会对全遍历情况产生性能影响?
这是个值得研究的问题,我测试下来,这个现象和排序无关,可能和这个大型字符串数组的寻址效率有关。
1. 不是sorted的原因
test_strings = tuple(test_strings) # 这一行
只要打乱原有顺序,不论是排序的,还是随机的,都会使得遍历变慢,比如:
"test_strings = sorted(test_strings)" 或者
"random.shuffle(test_strings)" 或者
"test_strings = random.sample(test_strings, len(test_strings))"
2. 和迭代内的操作无关
把这段代码从print('开始生成测试数据...')
for i in tqdm.tqdm(range(num)):
test_data_str = ''.join(
[random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
for _ in range(random.randint(3, 8))])
data.append((test_data_str, {j for j in test_strings if j.startswith(test_data_str)}))
改为一个空迭代:
print('开始生成测试数据...')
for i in tqdm.tqdm(range(num)):
for j in test_strings:
pass
也能明显比较出test_strings打乱原有顺序前后的效率差别
以下是我关于此例,内存寻址方面问题的一点推测,还待牛人指点:
0. 前提:
test_strings中的字符串们,创建时即被append,所以内存地址大致是顺序的(堆上分配的对象)
1. CPU缓存命中
«CPU高速缓存(英语:CPU
Cache,在本文中简称缓存)是用于减少处理器访问内存所需平均时间的部件。在金字塔式存储体系中它位于自顶向下的第二层,仅次于CPU寄存
器。其容量远小于内存,但速度却可以接近处理器的频率。当处理器发出内存访问请求时,会先查看缓存内是否有请求数据。如果存在(命中),则不经访问内存直接返回该数据;如果不存在(失效),则要先把内存中的相应数据载入缓存,再将其返回处理器»
缓存从内存中抓取一般都是整个数据块,所以它的物理内存是连续的。如果打乱原有顺序遍历的话,将会使整个缓存块无法被利用,而不得不从内存中读取数据,而从内存读取速度是远远小于从缓存中读取数据的。
2. 分页调度
显然test_strings里所有的字符串跨了多个内存页了,但是如前提所言,内存地址还是大致连续的"for j in test_strings"遍历时,并没有频繁地页面调度。但sorted排序后,这种顺序没了,会有频繁的页面调度,这个操作是有时间消耗的,调度次数越多,遍历时间越长。
PS: 你试一试 "test_strings = list(reversed(test_strings))"
参考阅读:"https://zhuanlan.zhihu.com/p/549919985" (https://link.segmentfault.com/?enc=y99tWuVHwMfkzGmJUvdwWg%3D%3D.a%2Fx3qIEyWw6ciSmMHDiEsrp6yJgyXsG3SiRDi3KQSyfoWNnVU4FC7Azn5eiXWyyz)
无情编码机器
echarts图表不能不满包裹容器?
检查 "initChart" 执行的时候。 ".linebarchart-page" 元素是否有固定的宽高?
因为 ".linebarchart-page" 和 ".chartbox" 都是 "width:100%;height:100%;" 所以如果 EChart
初始化之后外部容器的宽高改变了你的图表就不会重新 "resize"。需要给你的 ".chartbox" 做一下
"resize" (https://link.segmentfault.com/?enc=11sGMlg%2ByrI%2BL2NMuhu87w%3D%3D.BDUsMws3%2BkOC7NZ%2FbPyQ83eqZhi%2BJmQfCYQwTenBBsM4Yr%2BEgLDnu5UgoP6bZtadxljZza7tQFC9UjqiQOVikA%3D%3D)
的监听。改变宽高之后重新执行一下你的 "echartsInstance" 的
"resize" (https://link.segmentfault.com/?enc=LR2ntUzs%2F5F5boVTjlJKjg%3D%3D.bGnN8FZL2I7iT9vHNV7ap8z1YDBup19VwpzDaFSaGaQnU3sOWH2Q9A3lbTmFk12E%2BSTTuWagmfWH8V9oD0IvSg%3D%3D)
方法
***
"#echarts. init | Documentation - Apache ECharts" (https://link.segmentfault.com/?enc=4p%2BI2uTERgXlK5227mgx%2Fg%3D%3D.Xfk%2BkaassgQm9Ryz6cipBZMZgANpUFfZovDK9n8HRaY5PSy5%2FoLvC2ZkCTlkW8FSeTJ648O%2FB%2Bqz2lY%2FdjFXNw%3D%3D)
"#echartsInstance. resize | Documentation - Apache ECharts" (https://link.segmentfault.com/?enc=guJUQqmfCuRzBvbNr3Q8lg%3D%3D.wxdLPm63abNRmqD%2FgsT6O4d74rE8JqcoMAQaV3iUjAmBYGiu9dME9JXTlIFPJnfIJqvA4z9TsN%2B5AlL1UsfkKA%3D%3D)
"ResizeObserver - Web API | MDN" (https://link.segmentfault.com/?enc=0yigWwddLsgEuE0gVVR0lg%3D%3D.6MVuclnfmLMd%2BRFoTRWVlUKvM%2FqivJKqJh0WoNjSyCi%2Fzl3aBTEYIzg6uKu7YkcExKUAx7s20LvQG3%2Byy9bmIQ%3D%3D)
无情编码机器
JavaScript中textarea元素的值获取方法?
提交
var text = document.getElementById("text"),
btn= document.getElementById("btn");
btn.onclick = function () {
// var info = text.value;//方法一
var info = text.innerHTML;//方法二
console.log(info);
}
使用方法2不生效,是空值(纯空白,不是null),现版本innerHTML不能用吗有没有大佬知道,新手刚上路
无情编码机器
如何回滚到以前的状态?
git log
commit ef6760acae8c3c778b90975ea18d6969fa54de55 (HEAD -> master)
Author: xxxxxxxxxxxxxxxxx
Date: Sat Apr 27 16:40:29 2024 +0800
english
commit 23521475fea20408c5fe1aecb8a46bd1373349ad
Author: xxxxxxxxxxxxxxxxx
Date: Thu Apr 25 14:10:19 2024 +0800
english
我想回滚到Apr 25 的状态,应当如何操作?
无情编码机器
React官网示例中,关于遍历渲染的部分,这个怎么理解呢?
React的官网示例,有不明白的地方请教各位,希望能得到解惑。
const people = [
'凯瑟琳·约翰逊: 数学家',
'马里奥·莫利纳: 化学家',
'穆罕默德·阿卜杜勒·萨拉姆: 物理学家',
'珀西·莱温·朱利亚: 化学家',
'苏布拉马尼扬·钱德拉塞卡: 天体物理学家',
];
export default function List() {
const listItems = people.map(person =>
{person}
);
return {listItems};
}
官网地址:"https://react.docschina.org/learn/rendering-lists" (https://link.segmentfault.com/?enc=aYfj9Ub9CmZSfz8eceXbsQ%3D%3D.R0CdNaIPUqru2Es04sAy850fm2x%2FEJyQ0puPjZlrNue4Ch6JgaejrkXqYc6TRxsNn452olAQwYJwXiZD4hHZBQ%3D%3D)
问题1:{listItems}如果listItems是一个函数,我还能理解,可是这是个变量,看起来有点像数组变量,又有点不像,没有返回值啊。难道{}这个大括号就能输出自动遍历数组了?
问题2:{person},为什么前面没有return,也没有大括号包裹。
这种jsx语法看上去有点像js,但是又有点离谱。
尝试搜索很多资料了
无情编码机器
在.NET中如何获取并解析个人微信朋友圈数据?
.net 如何获取个人微信的朋友圈数据,最好还可以发布。
无情编码机器
前端工程安装依赖报python错误信息,如何解决?
全局安装"node-gyp"解决
"npm install -g node-gyp"
无情编码机器
构建SQL评审平台时,ANTLR4和Calcite哪个更适合进行SQL解析?
直接上chatgpt 不就行了