-
博客迁移通知
本站博客迁移至如下地址: SWR的博客 -
VLMCSD 激活
Microsoft KMS Activation Usage Start a Command Prompt as an Administrator. -
解决GitHub的raw.githubusercontent.com无法连接问题
修改hosts Ubuntu,CentOS及macOS直接在终端输入 sudo vi /etc/hosts 添加以下内容保存即可 -
Linux下搭建SS
首先root用户登陆 sudo -i 一、没有安装wget的先安装wget sudo yum -y install wget 二、下载一间安装脚本 ```bash mkdir ss_pack #建立文件夹 cd ss_pack #切换到文件夹 -
Find the sub max value of an array[查找给定数组的次大值]
int subMax(int a[],int n) { int max=a[0]; int sub_max=a[0]; for (int i = 1; i < n; i++) { if(a[i]>max) { //update max and sub max sub_max=max; max=a[i]; } else if(a[i]<max) { if(a[i]>sub_max) {//update sub max sub_max=a[i]; } } else { //do nothing } } return sub_max; } -
C/C++ Interview
转载:Github 📖 Github | 📚 Docsify -
Welcome to MyBlog!
欢迎来到我的个人博客! -
Shell
1 列出目录内容:ls -
STM32的I/O口的8种工作模式
STM32的I/O口的8种工作模式 : -
Python GUI之Tkinter入门模板
import tkinter as tk from tkinter import ttk from WebHelp import * import collections from threading import Thread import time from htmlbs import * class MainWindows(tk.Tk): TREESIZE = 30 QUEDELAY = 30 b_continueget = True __wh = '' __hb = HtmlBs() time_cost = 0.0 index_list = [] num_dict = collections.OrderedDict() __w = 1200 __h = 350 def __init__(self, path, url): super().__init__() # 初始化基类 self.title("夺金120S") self.geometry('1200x400') self.resizable(0, 0) self.ini_ui() self.__wh = WebHelp(path, url) self.__wh.configWeb() th_get = Thread(target=self.data_loop) th_get.setDaemon(True) th_get.start() def ini_ui(self): frame = tk.Frame(self, width=self.__w, height=self.__h) self.tree = ttk.Treeview(frame, show="headings") # 表格 tree_cln = ("期号", "中奖号码", "01,02", "01,03", "01,04", "01,05", "01,06", "01,07", "01,08", "01,09", "01,10", "01,11", "02,03", "02,04", "02,05", "02,06", "02,07", "02,08", "02,09", "02,10", "02,11", "03,04", "03,05", "03,06", "03,07", "03,08", "03,09", "03,10", "03,11", "04,05", "04,06", "04,07", "04,08", "04,09", "04,10", "04,11", "05,06", "05,07", "05,08", "05,09", "05,10", "05,11", "06,07", "06,08", "06,09", "06,10", "06,11", "07,08", "07,09", "07,10", "07,11", "08,09", "08,10", "08,11", "09,10", "09,11", "10,11" ) self.tree["columns"] = tree_cln # ("期号", "中奖号码", "01,02", "01,03", "01,04", "01,05", "01,06", "01,07", "01,08", "01,09", "01,10", "01,11") # 表示列,不显示 for item in tree_cln: self.tree.column(item, width=60, anchor="center") self.tree.column("期号", width=80, anchor="center") self.tree.column("中奖号码", width=150, anchor="center") # 显示表头 for item in tree_cln: self.tree.heading(item, text=item) self.tree.place(relx=0.004, rely=0.028, relwidth=0.964, relheight=0.95) # 给treeview添加滚动条 self.VScroll1 = tk.Scrollbar(frame, orient='vertical', command=self.tree.yview) self.VScroll1.place(relx=0.971, rely=0.028, relwidth=0.014, relheight=0.958) self.VScroll2 = tk.Scrollbar(frame, orient='horizontal', command=self.tree.xview) self.VScroll2.place(relx=0.008, rely=0.961, relwidth=0.958, relheight=0.024) self.tree.configure(yscrollcommand=self.VScroll1.set, xscrollcommand=self.VScroll2.set) # 给tree view填充初始数据 for i in range(self.TREESIZE): self.tree.insert("", 0, text=str(i), values=(str(i), str(i), "3", "3", "3", "3", "3", "3", "3", "3", "3", "3")) frame.pack() self.tree.pack() # 添加一个button self.btn = tk.Button(self, text='test') self.btn.pack(padx=200, pady=30) self.btn.config(command=self.test_fun) def test_fun(self): test = {} for i in range(30): test[i] = (i + 38) for item in test: print(item) def get_data(self): tm_start = time.time() html = self.__wh.getPage() soup = self.__hb.getSoup(html) inlist = self.__hb.getIndex(soup) if inlist is not None: self.index_list = inlist nudict = self.__hb.getNum(soup) if nudict is not None: self.num_dict = nudict tm_end = time.time() self.time_cost = tm_end - tm_start self.__wh.reflash_web() def data_loop(self): i = 0 while(self.b_continueget): i += 1 print('loop count:%d' % i) self.get_data() print(self.index_list) print(self.num_dict) self.update_tree() time.sleep(self.QUEDELAY) def update_tree(self): if self.index_list is not None: self.edit_item() x = self.tree.get_children() # for item in x: # self.tree.delete(item) # for i in range(self.TREESIZE): # self.tree.insert("", 0, text=str(i), values=(self.index_list[i], self.num_dict[i], "3", "3", "3", "3", "3", "3", "3", "3", "3", "3")) def edit_item(self): x = self.tree.get_children() i = 0 for item in x: if i < len(self.index_list): self.tree.item(item, values=(self.index_list[i], self.num_dict[i], "0", "0", "0", "0", "0", "0", "0", "0", "0", "0")) i += 1 if __name__ == '__main__': # chrome driver路径 path = 'C:/Program Files (x86)/Google/Chrome/Application/chromedriver.exe' # 抓取的网页url url = "https://ds.dsproxy.net/ds_jxf01/#/game/1-3-5" app = MainWindows(path, url) app.mainloop() -
C++ Template之多自定义参数实例化
简单写个示例:【VS2012编译运行通过】 -
ROS学习笔记---Beginner Level常用操作
@TOC -
J1939协议简介
SAE J1939协议是基于CAN2.0B协议之上的应用层协议,但是SAE J1939协议并不仅仅是个应用层协议,她对物理层,数据链路层,网络层,应用层,故障诊断, 网络层管理层等都做了详细的规定,只不过这其中很多规定都跟CAN2.0B一致。我们这里只介绍J1939的应用层,对软件开发来说已经足够。 对熟悉CAN2.0B协议的小伙伴来说,其实只要掌握下面几个关键点,J1939就瞬间不再神秘。 -
Git 之常用设置
用户设置 git config --global user.name "FNR_S" git config --global user.email QQ@QQ.com git config --global credential.helper manager -
Windows批处理脚本(一)
基本命令 | cmd | | |–|–| | dir | 列文件名| |cd | 改变当前目录 |ren | 改变文件名 |copy | 拷贝文件 |del | 删除文件 |md | 建立子目录 |rd | 删除目录 |deltree| 删除目录树 |format | 格式化磁盘 |edit | 文本编辑 |type | 显示文件内容 |mem | 查看内存状况 |help | 显示帮助提示 |cls | 清屏 |move | 移动文件,改目录名 |more | 分屏显示 |xcopy | 拷贝目录和文件 -
C/C++之单链表的节点删除和插入
#include<stdio.h> #include<stdlib.h> //Linked-list structure typedef struct ListNode { int data; //data field struct ListNode *next; //point to next node } Node,*PNode; //creat a linklist,the counts of node is cnt,datasource is pData PNode CreatLinkedList(const int cnt,int *pData) { //malloc head node PNode pHead=(PNode)malloc(sizeof Node); if(pHead==NULL)//if phead is null { return NULL; } int i=0; PNode pRail=pHead; //rail node for traversing linked list while(i<cnt) { PNode pNext=(PNode)malloc(sizeof Node);//malloc every node if(pNext==NULL) break; pNext->data=*pData++; pRail->next=pNext; pNext->next=NULL; pRail=pNext; ++i; } return pHead; } //delete the node that the data==num PNode DeleteNode(PNode list,int num) { if(list->data==num) { return list->next; } PNode p=list; PNode pn=NULL; while (p!=NULL) { pn=p; //save privious node p=p->next; //increase if (p==NULL) { printf("There is no finding in the list!\n"); } else if(p->data==num) { pn->next=p->next; } else { //printf("There is no finding in the list!\n"); } } return list; } //insert one node(data=ins_num) behind the node which data==num PNode InsertNode(PNode list,int num,int ins_num) { PNode p=list; while (p!=NULL) { if(p->data==num) { PNode pNew=(PNode)malloc(sizeof PNode); pNew->data=ins_num; pNew->next=p->next; p->next=pNew; break; } //increase p=p->next; } return list; } //main.c test int main() { int n=5; int a[5]={0,1,2,3,4}; PNode lnode; lnode=CreatLinkedList(n,a); DeleteNode(lnode,5); PNode p=InsertNode(lnode,3,6); //printf the linked list while(p->next!=NULL) { p=p->next; printf("%d\n",p->data); } printf("Hello World\n"); system("pause"); return 0; } -
c#读取Excel
1、下载微软官方提供的操作Excel的dll,Microsoft.Office.Interop.Excel.dll -
CentOS 7搭建ss服务器
首先root用户登陆 sudo -i 一、没有安装wget的先安装wget sudo yum -y install wget 二、下载ss一键安装脚本 ``` mkdir ss_pack #建立文件夹 cd ss_pack #切换到文件夹 -
ubuntu16.04安装chrome谷歌浏览器
1、启动终端 sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.list.d/ wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - sudo apt-get update sudo apt-get install google-chrome-stable /usr/bin/google-chrome-stable 2、为chrom安装flash播放器 屏幕右上角,“系统设置”–>“软件和更新”–>“其它软件” 勾选“Canonical合作伙伴” 点击“关闭” 终端输入 sudo apt install adobe-flashplugin -
ButterWorth滤波
function y=highp(x,f1,f3,rp,rs,Fs) %高通滤波 %使用注意事项:通带或阻带的截止频率的选取范围是不能超过采样率的一半 %即,f1,f3的值都要小于 Fs/2 %x:需要带通滤波的序列 % f 1:通带截止频率 % f 2:阻带截止频率 %rp:边带区衰减DB数设置 %rs:截止区衰减DB数设置 %FS:序列x的采样频率 % rp=0.1;rs=30;%通带边衰减DB值和阻带边衰减DB值 % Fs=2000;%采样率 %频率归一化 wp=2*f1/Fs; ws=2*f3/Fs; %{ % 设计切比雪夫滤波器; [n,wn]=cheb1ord(wp/pi,ws/pi,rp,rs); % [bz1,az1]=cheby1(n,rp,wp/pi,'high'); %} %% 设计巴特沃斯滤波器 %//注意切比雪夫和巴特沃斯传入参数的不同rp [n,wn]=buttord(wp,ws,rp,rs); [bz1,az1]=butter(n,wn,'high'); %{ %查看设计滤波器的曲线 % [h,w]=freqz(bz1,az1,256,Fs); %求离散系统频响特性的函数freqz() % h=20*log10(abs(h)); % figure;plot(w,h);title('所设计滤波器的通带曲线');grid on; %} %% 滤波函数 y=filter(bz1,az1,x); end -
Qt Creator5.8调用大漠插件
在网上找了很多,没找到这方面的教程,通过Qt官方帮助终于调试成功。Qt有专门的类实现com组件的调用,说明文档上有很多种方式,这里简单说明一种方式。 -
WIN7下C#调用大漠插件
关于大漠插件,网上看了很多教程,自己走了很多坑,终于调试成功,现在将坑公之于众。 第一步,首先选择调试平台,大漠插件只支持32位编译,如果不选择实例化大漠对象的时候会出现没有注册类的报错,这个坑了我很久,如下图所示,右键程项目->属性 -
让人震撼惊讶的85句话!
1、别低估任何人。 -
IT人生畅想
1,人生最重要的不是努力,不是奋斗,而是抉择。