首页
统计
壁纸
留言板
友情链接
更多
直播
实用工具
Search
1
浏览器 | 开启Chrome和Edge的多线程下载功能(Parallel downloading)
1,946 阅读
2
给孙小姐的一封情书
544 阅读
3
OpenWRT | 作为 旁路由/单臂路由/透明网关 设置 DDNS
323 阅读
4
LabVIEW | 各版本及开发工具模块下载
319 阅读
5
armUbuntu系统构建
297 阅读
取次花丛懒回顾
默认分类
C#
MySQL
LabVIEW
Java
Android
PHP
Python
handsome
相册
百度地图
嵌入式
嵌入式Ubuntu
I.MX6ULL
linux
Unity
Golang
Rust
OpenHD
教学计划
Search
标签搜索
C#
handsome
Git
动态壁纸
开源
Unity3d
Unity
csharp
Moao
累计撰写
185
篇文章
累计收到
28
条评论
首页
栏目
取次花丛懒回顾
默认分类
C#
MySQL
LabVIEW
Java
Android
PHP
Python
handsome
相册
百度地图
嵌入式
嵌入式Ubuntu
I.MX6ULL
linux
Unity
Golang
Rust
OpenHD
教学计划
页面
统计
壁纸
留言板
友情链接
直播
实用工具
搜索到
185
篇与
的结果
2024-07-08
Android | 判断 Activity 是否正在前台显示
代码 /** * 判断某个activity是否在前台显示 */ public static boolean isForeground(Activity activity) { return isForeground(activity, activity.getClass().getName()); } /** * 判断某个界面是否在前台,返回true,为显示,否则不是 */ static boolean isForeground(Activity context, String className) { if (context == null || TextUtils.isEmpty(className)) return false; ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningTaskInfo> list = am.getRunningTasks(1); if (list != null && !list.isEmpty()) { ComponentName cpn = list.get(0).topActivity; return cpn != null && className.equals(cpn.getClassName()); } return false; }调用 if (isForeground(activity)){ //在前台显示,做逻辑 }
2024年07月08日
120 阅读
0 评论
0 点赞
2024-07-08
Java | 判断 两个 Date 相差多少时间
以下代码只返回相差秒数的"分钟部分",如果想得到总秒数,应该这样计算:long diffSeconds = diff / 1000; 旧版的java.util.Dateimport java.util.Date; import java.text.SimpleDateFormat; public class Main { public static void main(String[] args) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date1 = sdf.parse("2020-01-01 00:00:00"); Date date2 = sdf.parse("2020-01-02 00:00:00"); long diff = date2.getTime() - date1.getTime(); long diffSeconds = diff / 1000 % 60; System.out.println("相差秒数: " + diffSeconds); } }新版本 Javaimport java.time.LocalDateTime; import java.time.Duration; public class Main { public static void main(String[] args) { // 创建两个 LocalDateTime 对象 LocalDateTime dateTime1 = LocalDateTime.of(2020, 1, 1, 0, 0); LocalDateTime dateTime2 = LocalDateTime.now(); // 使用 Duration.between() 方法计算两个时间点之间的时间差 Duration duration = Duration.between(dateTime1, dateTime2); // 输出相差的秒数 long seconds = duration.getSeconds(); System.out.println("相差秒数: " + seconds); } }
2024年07月08日
149 阅读
0 评论
0 点赞
2024-07-06
openwrt | 修改静态 ip
查看vim /etc/config/network原来的 是 dhcp修改然后重启网卡 生效/etc/init.d/network restart
2024年07月06日
125 阅读
0 评论
0 点赞
2024-07-06
Ubuntu 24.04 | 静态 IP
修改 yaml 文件1.查看 yaml 文件cd /etc/netplan ls2.编辑 yaml 文件network: ethernets: ens33: # 配置的网卡的名称 dhcp4: false # 关闭 DHCP ,如果需要打开 DHCP 则写 true addresses: [10.10.100.253/24] # 配置的静态ip地址和掩码 optional: true routes: - to: default via: 10.10.100.254 # 网关地址 nameservers: addresses: [1.1.1.1,8.8.8.8] version: 2 renderer: networkd #指定后端采用systemd-networkd或者Network Manager,可不填写则默认使用systemd-workdip 地址和 DNS 服务器地址需要用[]括起来,但是网关地址不需要每个冒号后边都要先加一个空格每一层前边的缩进,至少比上一层多两个空格应用修改sudo netplan apply查看 ipip a
2024年07月06日
152 阅读
0 评论
0 点赞
2024-07-05
Golang | 从 url 路径 中提取文件名
url 获取文件名url="https://dldir1.qq.com/qqfile/qq/PCQQ9.6.2/QQ9.6.2.28756.exe" filepath.Base(url)filepath.Base(url) 就 为 QQ9.6.2.28756.exe路径中获取 文件名 exePath := "C:\WINDOWS\system32\calc.exe" fileNameWithExt := filepath.Base(exePath) // 获取带 扩展名 的名字 fileNameNoExt := strings.TrimSuffix(fileNameWithExt, filepath.Ext(exePath)) // 获取不带 扩展名 的名字fileNameWithExt 为 calc.exefileNameNoExt 为 calc
2024年07月05日
119 阅读
0 评论
0 点赞
1
...
15
16
17
...
37