智能助手网
标签聚合 or

/tag/or

hnrss.org · 2026-04-18 23:10:57+08:00 · tech

Do you work with Gradle and need to generate Java POJO classes from Avro schemas? I’m excited to share my first open-source project: https://github.com/flumennigrum/gradle-avro-plugin . It’s now live on the Gradle Plugins Portal, so you can easily add it to your projects. Why a new plugin? For years, I’ve relied on davidmc24/gradle-avro-plugin, probably the most widely used community Avro plugin in the Gradle ecosystem. Unfortunately, it was archived in 2023, raising maintenance concerns for modern JVM projects. My solution: a new plugin compatible with Gradle 7.3+ and Java 11+ (tested with 11, 17, 20, and 25). The goal is to keep it alive and working with newer releases of gradle, java and avro. Check it out, issues and contributions are welcome! Comments URL: https://news.ycombinator.com/item?id=47816519 Points: 2 # Comments: 0

linux.do · 2026-04-18 23:02:59+08:00 · tech

Azure的公共IP只允许创建静态IP,静态IP又不在azure for student的额度上,然后扣你余额。 Azure学生包 创建机器默认静态IP 改为动态IP可避免扣费 开发调优 默认配置下来就是静态ip,两台机器一年下来 这100刀基本上就搭进去了 已经创建的虚拟机无法从静态改为动态,只能删机重建 创建时ip要选择基本层,然后才能选择动态ip,不重启应该不会变 [image] 我创建时SKU只有标准,也就改不了动态IP。 好在我之前建了一个有公共IP的虚拟机,又建了一个虚拟网络。我把新老虚拟机都搭载到了虚拟网络上,用老虚拟机访问新虚拟机,同区域间的流量传输不收费。 :新虚拟机如果选择密钥认证,密钥要放在老虚拟上。 只不过这样虚拟机似乎访问不了网络,所以我让老虚拟机做NAT,转发新虚拟机的流量。 首先把老虚拟机的入站端口打开,让新虚拟机的流量能进入老虚拟机。 两台机器都要搭载到一个虚拟网络,但子网不能相同。设定两台机器在子网的静态IP,假设老机器是10.0.0.5,新机器是10.0.1.7。 老虚拟机的网络接口打开“启用 IP 转发”。为新虚拟机建立资源“路由表”,绑定新机器的子网,下一个跃点类型设为VirtualAppliance,下一个IP跃点设为老机器子网IP,即10.0.0.5。 老机器确认出口网卡 ip -br addr 一般是eth0。 老机器启用内核转发 echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-azure-nat.conf sudo sysctl --system 配置NAT规则 sudo iptables -t nat -A POSTROUTING -s 10.0.1.0/24 -o eth0 -j MASQUERADE sudo iptables -A FORWARD -s 10.0.1.0/24 -o eth0 -j ACCEPT sudo iptables -A FORWARD -d 10.0.1.0/24 -m conntrack --ctstate ESTABLISHED,RELATED -i eth0 -j ACCEPT 持久化规则 sudo apt update sudo apt install -y iptables-persistent sudo netfilter-persistent save 然后新机器就可以正常上网了。最后在老机器配置反向代理,就可以通过老机器访问新机器的服务了。 这套方案要确保老机器正常运行,否则两个机器一起down,特别是内存,azure for student免费的机器只有1G内存,最好提前添加交换区。 1 个帖子 - 1 位参与者 阅读完整话题

linux.do · 2026-04-18 22:05:59+08:00 · tech

<script setup> import { ref } from 'vue'; import { onLoad } from '@dcloudio/uni-app'; import request from '@/utils/request'; import { getFiles, getRandomFile, getFileArray } from '@/utils/yangUtils'; const imageSuffix = ['png', 'jpg', 'jpeg']; const videoSuffix = ['mp4', 'avi', 'mov']; const imageNum = ref(0); const videoNum = ref(0); // 获取父级传入的数据 const props = defineProps(["modelValue", "limit", "message", "isDelete", "isAdd"]); // 定义 emits const emit = defineEmits(['update:modelValue']); // const listData = ref(["https://yxdjpw.oss-cn-beijing.aliyuncs.com/uploadDefault/20260417192542-d3ea46.png", "https://yxdjpw.oss-cn-beijing.aliyuncs.com/uploadDefault/20260417194449-bfb1ba.mp4"]); const listData = ref([]) const onSelectFile = async () => { let result; // #ifdef APP || APP-PLUS || MP-WEIXIN || MP-TOUTIAO || MP-LARK || MP-JD || MP-HARMONY || MP-XHS result = await uni.chooseMedia({ count: props.limit || 9, mediaType: ['image', 'video'], sourceType: ['album', 'camera'], maxDuration: '30s' }) // #endif // #ifdef WEB || H5 result = await uni.chooseFile({ count: props.limit || 9, type: 'all', }) // #endif let arr = []; console.log(result); for (let filePath of result.tempFiles) { // 判断文件是否超出10M if (filePath.size > 10 * 1024 * 1024) { uni.showModal({ title: '提示', content: '文件大小不能超过10M!', showCancel: true, }) return; } if (imageSuffix.includes(filePath.name.replaceAll('"', '').split('.').pop()?.toLowerCase())) { imageNum.value++; } else if (videoSuffix.includes(filePath.name.replaceAll('"', '').split('.').pop()?.toLowerCase())) { // 判断之前有没有上传过视频或者图片 if (imageNum.value >= 1 || videoNum.value >= 1) { uni.showModal({ title: '提示', content: '图片和视频不能同时上传,并且视频只能上传一个!', showCancel: true, }) return; } videoNum.value++; } const data = await request("/upload/uploadFile", filePath.path, "post"); arr.push(getFileArray(data)[0]); } listData.value = listData.value.concat(arr); // 将数据返回出去 emit("update:modelValue", listData.value.join(",")); } // 删除 const onDelete = (index) => { // 1. 先拿到要删除的项(必须在 splice 之前拿!) const deletedItem = listData.value[index]; // 2. 判断类型,更新计数 const ext = deletedItem.split('.').pop()?.toLowerCase(); if (imageSuffix.includes(ext)) { imageNum.value--; } else if (videoSuffix.includes(ext)) { videoNum.value--; } // 3. 再删除元素 listData.value.splice(index, 1); // 4. 更新双向绑定 emit("update:modelValue", listData.value.join(",")); } // 查看 const onView = (item) => { } // 类型判断 const isSuffix = () => { return listData.value.some(item => { // 获取后缀(转小写,避免大小写问题) const ext = item.split('.').pop()?.toLowerCase() return videoSuffix.includes(ext) }) } </script> <template> <view> <view class="header"> <view v-if="props.message" class="message">{{ props.message }}</view> <view class="numCount">{{ `${listData.length}/${props.limit || 9}` }}</view> </view> <view class="image-grid" :class="isSuffix() ? 'grid-video' : ''"> <template v-for="(item, index) in listData" :key="index"> <view class="grid-item grid-item-content" :class="isSuffix() ? 'grid-item-video' : ''" @click="onView(item)"> <image v-if="imageSuffix.includes(item.split('.').pop())" class="img" :src="item" mode="aspectFill" /> <video v-else-if="videoSuffix.includes(item.split('.').pop())" class="video" :src="item" /> <view class="grid-item-delete" v-if="(isAdd ?? true)" @click="onDelete(index)"><uni-icons class="icon-delete" type="closeempty" color="#D3D4D6" size="24" /></view> </view> </template> <view class="grid-item icon-add" v-if="(isAdd ?? true) && !isSuffix() && listData.length < (props.limit ?? 9)" @click="onSelectFile()"> <uni-icons type="plusempty" size="60" color="#F1F1F1"></uni-icons> </view> </view> </view> </template> <style lang="scss" scoped> .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20rpx; } .image-grid { display: grid; grid-template-columns: repeat(3, 1fr); /* 一行3个,自动均分 */ gap: 20rpx; /* 格子间距 */ box-sizing: border-box; } .grid-item { width: 240rpx; height: 240rpx; } .grid-video { grid-template-columns: repeat(1, 1fr) !important; } .grid-item-video { width: 100%; height: 400rpx; } .numCount { display: flex; flex-direction: row-reverse; font-size: 26rpx; } .img, .video { width: 100%; height: 100%; } .grid-item-content { position: relative; } .icon-add { background: #FFFFFF; line-height: 240rpx; text-align: center; border: 1rpx solid #EEEEEE; border-radius: 6rpx; } .grid-item-delete { position: absolute; top: 0rpx; right: 0rpx; z-index: 1; } </style> 方法解析 文件后端返回的是 /api/upload/xxx.png getFiles 将图片拼接成正常能访问的 比如 http://域名.com/api/upload/xxx.png getRandomFile 是随机访问 getFileArray 是拼接成数组 limit → 最多上传数量 默认为9 message → 提示 比如请上传视频 可不填 isDelete → 是否可以删除重新上传 默认为true isAdd → 是否可以新增,比如有些地方可以直接回显 比如产品的图片,但是你不想让它显示新增的框 可以为false 默认为true // 文件加载 export const getFiles = (url) => { if (!url) { return ""; } if (url.startsWith("http://") || url.startsWith("https://")) { return cleanString(url); } else { return baseURL + cleanString(url); } }; // 随机加载文件 export const getRandomFile = (url) => { if (!url) { return ""; } const urls = url.split(","); const randomIndex = Math.floor(Math.random() * urls.length); const selectedUrl = urls[randomIndex]; if ( cleanString(selectedUrl).startsWith("http://") || cleanString(selectedUrl).startsWith("https://") ) { return cleanString(selectedUrl); } else { return baseURL + cleanString(selectedUrl); } }; export const getFileArray = (url) => { if (!url) { return []; } let baseUrl = []; url.split(",").forEach((v) => { if ( cleanString(v).startsWith("http://") || cleanString(v).startsWith("https://") ) { baseUrl.push(cleanString(v)); } else { baseUrl.push(baseURL + cleanString(v)); } }); console.log(baseUrl); return baseUrl; }; 请求就是 uni.request的请求 你们按照你们自己的改 当前只支持H5 你们需要的话 我会再更新 如果上传了视频就直接独占一行 并且不能上传其他视频和图片 仿照的是朋友圈 其他页面调用就是 比如文件名叫uploadFile.vue吧 import UpLoadFile from '@/components/uploadFile.vue' // 页面代码 <UpLoadFile v-model="form.media" /> 第一次封装 还有些问题 我会持续更新的 1 个帖子 - 1 位参与者 阅读完整话题

www.ithome.com · 2026-04-18 21:18:37+08:00 · tech

IT之家 4 月 18 日消息,消息源 Canon Rumors 前天发文称,佳能可能会为 EOS R7 Mark II 无反相机引入 DIGIC Accelerator Lite 精简版处理器。 据报道,佳能已经在 EOS R1 和 R5 Mark II 相机中使用过 DIGIC Accelerator 处理器,用于提升相机的数据处理能力。该芯片可与高速背照式 / 堆栈式传感器配合,带来更快的电子快门速度、自动对焦性能, 大幅降低果冻效应 , 还可以同时记录照片和视频 。 IT之家注意到,EOS R6 Mark III 并没有搭载这枚处理器,原因可能不只是成本问题,也与该机采用前照式 CMOS 有关,读取速度明显慢于高端机型。 目前已有传闻称,佳能 EOS R7 Mark II 将成为首款搭载背照式堆栈传感器的 APS-C 画幅 EOS-R 相机。如果相关消息属实,那么更高的读出速度需要搭配更强的处理器。 值得注意的是,佳能的 DIGIC X 处理器本身就有不同版本,例如 R1、R5 Mark II 等高端机型搭载满血版处理器,性能明显优于 R6 Mark III 和 R8 等中端机型。 不过,佳能显然没有必要去刻意限制 R7 Mark II 的性能,APS-C 和全画幅之间本来就已经形成明显的定位区别。

linux.do · 2026-04-18 21:09:24+08:00 · tech

new_api_panic: Panic detected, error: runtime error: invalid memory address or nil pointer dereference. Please submit a issue here: GitHub - QuantumNous/new-api: A unified AI model hub for aggregation & distribution. It supports cross-converting various LLMs into OpenAI-compatible, Claude-compatible, or Gemini-compatible formats. A centralized gateway for personal and enterprise model management. 🍥 · GitHub | Upstream: {“error”:{“message”:“Panic detected, error: runtime error: invalid memory address or nil pointer dereference. Please submit a issue here: https://github.com/Calcium-Ion/new-api",“type”:"new_api_panic ”}} 2 个帖子 - 2 位参与者 阅读完整话题

hnrss.org · 2026-04-18 20:30:16+08:00 · tech

I built LogsGo as a learning project to explore log ingestion, querying, and storage tradeoffs. It’s a small Go-based system where logs come in over gRPC, land in memory first, then flush into local storage and optionally S3-compatible object storage. I also added a simple query language plus a small UI to inspect log occurrences over time. This wasn’t built because I think the world needed “another logging system” or because I’m an expert here. I mostly wanted to learn by building something end to end: ingestion paths, storage layering, querying, retention, auth/TLS, and some UI work. Repo: https://github.com/Saumya40-codes/LogsGO I’d genuinely appreciate feedback, including “this design is wrong for X reason” type feedback. If parts of it feel overengineered / naive / badly thought through, that’s useful for me too. Comments URL: https://news.ycombinator.com/item?id=47815402 Points: 1 # Comments: 0