soft
[Solve Error] Install g++ in Ubuntu20.04 : g++ : Depends: g++-7 (>= 7.4.0-1~)
这是在Windows10上的Ubuntu WSL环境中遇到的问题。 目前的Ubuntu版本是Ubuntu 20.04.1 LTS。并且使用了阿里的apt镜像源。 先说结论,Ubuntu版本之高使得本机使用apt源中没有所需的库版本。所以可以尝试将apt源换回官方源。然后apt update再安装g++。 以下是断案过程。 在使用命令sudo apt install g++遇到了依赖问题。整个依赖链排查结果如下: sucicada@20200702-143805:/etc/apt/sources.list.d$ sudo apt install g++ Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: g++ : Depends: g++-7 (>= 7....
APG -- Algorithm PlayGround 基于Phaser 的算法游戏(类rpg)框架
APG——Algorithm PlayGround 项目地址 一个有趣,智能和简单的HTML5游戏框架 简单的开发方式,将你的算法变成游戏 对PhaserCE库的封装开发 70+个函数接口可供使用,通过配置文件智能优化游戏 提供可视化的地图编辑方案 官网 官网(备用) Demo 演示 git page(可能会慢) 国内使用 使用在线地图编辑器 APG MapEditor 下载 APG.js MapEditor 使用在线库 github直连 https://sucicada.github.io/Algorithm-PlayGround/dist/APG.js 国内使用(更快) http://sucicada.tk:39/APG/dist/APG.js 最后 十分感谢 @llwwdbd, @lesen-bee 在开发期间所提供的帮助
assmbly 8086汇编:判断奇数偶数
如果ax中的数是奇数:bx为0 否则bx为1 ; judge which the number in ax is odd or even assume cs:code code segment mov ax,[bx] mov cx,ax mov bx,0 s: loop i ; if can't loop , cx is 1 ; every loop, cx -= 2 ; odd mov bx,0 loop k i: ; sub cx,1 loop s ; even mov bx,1 ; loop k k: ;over mov ax,4c00h int 21h code ends end
atom删除文件: The following file couldn't be moved to trash (is gvfs-trash installed?)
参考这个 在使用加环境变量无果 环境 ubuntu 16 atom 1.4 执行以下命令 sudo mkdir -p /.Trash-1000/{expunged,files,info} sudo chown -R $USER /.Trash-1000
cin、cin.get()、cin.getline()、getline()、gets()等函数的用法
参考于cin、cin.get()、cin.getline()、getline()、gets()等函数的用法 cin» (1) » 是会过滤掉不可见字符(如 空格 回车,TAB 等) cin.get() (1) cin.get(char);//接受一个字符 (2) cin.get(char*,接收字符数目);//可以接收空格,接收数目=实际接收字符+1个’\0' cin.getline() (1) cin.getline(char*,接收数目); //可以接收空格,接收数目=实际接收字符+1个’\0' (2) cin.getline(char*,接收数目,结束字符) //当第三个参数省略时,系统默认为’\0’ //cin.getline(str,5,‘a’);当输入abcdef时输出abcd,输入jkaljkljkl时,输出jk #include<string> 1.getline(cin,string str);//可以接收空格 2.gets(char *str);//可以接收空格 3.getchar()//getchar()是C语言的函数,C++也可以兼容,但是尽量不用或少用;
clion 代码补全很慢 ( clion code completion slow) clangd 配置
查看官网 https://www.jetbrains.com/help/clion/settings-languages-cpp-clangd.html中 关于code completion 的说明 以下配置开启路径: File | Settings | Languages and Frameworks | C/C++ | Clangd for Windows and Linux CLion | Preferences | Languages and Frameworks | C/C++ | Clangd for macOS 我们得知 CLion 提供了两种代码提示引擎一种内置,一种是 Clangd。 默认的选择是只用Clangd,而不会优先用内置引擎。我们选择剩下两个会发现代码提示的速度快了很多。 这个现象能初步判断内置引擎比Clangd要快。至于更深层的原因还待研究。
DFS的递归实现
对一个例子的理解,以下是关系图的关系矩阵,求从1开始能到哪个数 #include<iostream> #include<queue> # e<cstdio> #include<vector> #include<stack> using namespace std; int const N =5; int maze[N][N]={ {0,1,1,0,0}, {0,0,1,0,1}, {0,0,1,0,0}, {1,1,0,0,1}, {0,0,1,0,0} }; int visit[N+1]={0}; //循环的思路: //用递归,一旦有更深的点就产生新的循环,当深的点操作完了,就结束了这个陷得最深的循环。 void dfs1(int start) { visit[start]=1; for(int i=1;i<=N;i++) { if(!visit[i]&&maze[start-1][i-1]==1) { dfs1 (i); } } cout<<start<<" "; } void dfs2(int start) { stack<int>s; s.push(start); visit[start]=1; int iff=0; while(!s.empty()) { iff=0; int v=s.top(); for(int i=1;i<=N;i++) { if(visit[i]==0&&maze[v-1][i-1]==1) { iff=1;//代表if了 visit[i]=1;//第一层 s.push(i); break;//保证当前只走一条路 } } if(iff==0)//到头不if才执行 { cout<<v<<" "; s....
istringstream、ostringstream、stringstream 类介绍 .
见以下链接 istringstream、ostringstream、stringstream 类介绍 . 0、C++的输入输出分为三种: (1)基于控制台的I/O #include<iostream> (2)基于文件的I/O #include<fstream> (3)基于字符串的I/O #include<sstream> str():使istringstream对象返回一个string字符串 stringstream::clear()//多次使用,先清空此对象的流,不能使用stream.str(""); //实际上,它并不清空任何内容,它只是重置了流的状态标志而已 ps:但如果你要在程序中用同一个流,反复读写大量的数据,将会造成大量的内存消耗, 这时候,需要适时地清除一下缓冲 (用 stream.str("") )。
js 生成当前日期时间
精简版 var date = new Date(); datetime = date.toLocaleDateString().split('/').slice(2,3).concat( date.toLocaleDateString().split('/').splice(0,2)).join('-') + " " + ( date.toLocaleTimeString().split(' ')[1]=='AM' ? date.toLocaleTimeString().split(' ')[0] : [parseInt(date.toLocaleTimeString().split(' ')[0].split(':')[0]) + 12].concat( date.toLocaleTimeString().split(' ')[0].split(':').splice(1,3)).join(':') ); 人看的版 var date = new Date(); var dd = date.toLocaleDateString().split('/'); var dd = dd.slice(2,3).concat( dd.splice(0,2)).join('-'); var time = date.toLocaleTimeString().split(' '); var time = time[1]=='AM' ? time[0] : [parseInt(time[0].split(':')[0]) + 12].concat(time[0].split(':').splice(1,3)).join(':'); var datetime = dd + " " + time;
linux 通过 openconnect 来连接学校内网
参考 http://xingda1989.iteye.com/blog/1969908 https://blog.csdn.net/edin_blackpoint/article/details/70860101 sudo apt install openconnect 在/etc/vpc/目录下新建vpnc-script 文件 文件内容可以到此处拷贝 http://git.infradead.org/users/dwmw2/vpnc-scripts.git/blob_plain/HEAD:/vpnc-script sudo openconnect --juniper -u [你的学号] --script /etc/vpnc/vpnc-script [你学校的提供的vpn的url]
Linux Mint 使用 VNC Server (x11vnc) 进行远程屏幕
https://community.linuxmint.com/tutorial/view/2334 This tutorial was adapted from here. Remove the default Vino server: sudo apt-get -y remove vino Install x11vnc: sudo apt-get -y install x11vnc Create the directory for the password file: sudo mkdir /etc/x11vnc Create the encrypted password file: sudo x11vnc --storepasswd /etc/x11vnc/vncpwd You will be asked to enter and verify the password. Then press Y to save the password file. Create the systemd service file for the x11vnc service: sudo xed /lib/systemd/system/x11vnc....
linux mint系统 cinnamon桌面 发大镜功能
让我来告诉迷途中的你cinnamon桌面一个好用的功能. 选择设置 选择窗口 -> 选择行为 看那个窗口移动和调整大小的特殊键 Alt 好了按住alt在滑动滑轮 世界不一样了 对于小屏幕高分辨率电脑极为友好
linux remmina 使用rdp协议连接windows显示Failed to startup SSH session:connection refused解决
https://cn.aliyun.com/jiaocheng/165641.html 删除~/.freerdp/known_hosts 但是我找不见这个文件 尝试删除~/.remmina/remmina.pref 文件 成功
linux 下安装 Cisco Packet Tracer 7.11以及一些注意(辛酸史)
https://blog.csdn.net/qq_35882901/article/details/77652571 https://linux.cn/article-5576-1.html 开启登录问题 https://blog.csdn.net/u012321131/article/details/78587383 到软件的根目录下 执行以下脚本 sudo ./set_ptenv.sh sudo ./set_qtenv.sh **一定按步骤走 ** 安装在默认的/opt/pt 如果因为安装在家目录而导致闪退 就重新安装在默认路径下 一些依赖库 sudo apt install libqt5scripttools5 sudo apt-get install libqt5multimedia5-plugins 2018/9/18 因为3560的三层交换机的端口信息不显示,忍不了linux的bug,下了6版本的linux版本. 安装失败, 换回7版本,(核心已转储)…..made? 一个晚上的尝试,发现只是在当前的这个用户下运行不了,…..放弃了, 那么用wine吧 满心欢喜的安装好了,然后打算慢慢的把7版本的实验在6版本上重打一遍, 但是,cpu占用28,温度81…….耗不起 那么赞颂我们伟大的虚拟机吧 virtualbox的无缝模式太强大了,wine什么的掰掰吧,
linux 下的torrent下载器qBitTorrent
BT下载利器–Qbittorrent完全攻 Ubuntu使用命令安装qBittorrent的方法 源码下载
mysql workbench闪退解决办法
感谢google,感谢csdn linux下: rm -rf .mysql/workbench/ windows下: 删除C:\Users\Administrator\AppData\Roaming\MySQL\Workbench 这个问题没有社区的帮助,我就真的没辙了
mysql数据库连接以及执行的java类
应该使用json等配置文件来保存要连接的数据库信息,密码等. 先存一下,以后再说 DB_connection.java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; /** * * @author peng */ public class DB_connection { // JDBC 驱动名及数据库 URL String JDBC_DRIVER = "com.mysql.jdbc.Driver"; String DB_URL = "jdbc:mysql://localhost:3306/javabbs?useUnicode=true&characterEncoding=UTF-8"; // 数据库的用户名与密码,需要根据自己的设置 String USER = "root"; String PASS = "mysql"; Connection conn = null; // private static DB_connection dB_connection =null; // public static DB_connection getInstance(){ // if(DB_connection == null){ // DB_connection = new DB_connection; // } // return DB_connection; // } public Connection connect(){ try{ Class....
NYOJ-1204 魔法少女
http://nyoj.top/problem/1204 #include<iostream> using namespace std; int h[10006]; int d[10006][2]; // 每一 //int fun(int a,int b){ // if(a<0) // return 0; // if(b==0){ // if(d[a-1][0]<d[a-1][1]){ // cout<<d[a-1][0]<<" "<<a-1<<" "<<0<<endl; // fun(a-1,0); // }else{ // cout<<d[a-1][1]<<" "<<a-1<<" "<<1<<endl; // fun(a-1,1); // } // }else{ // if(d[a-1][0] < d[a-2][0]){ // cout<<d[a-1][0]<<" "<<a-1<<" "<<0<<endl; // fun(a-1,0); // }else{ // cout<<d[a-2][0]<<" "<<a-2<<" "<<0<<endl; // fun(a-2,0); // } // } //} int main(){ int n; while(cin>>n){ for(int i=0;i<n;i++){ cin>>h[i]; } // 0 not // 1 do d[0][0] = h[0]; d[0][1] = 0; d[1][0] = h[1]; d[1][1] = 0; for(int i=2;i<n;i++){ d[i][0] = min(d[i-1][1], d[i-1][0]) + h[i]; d[i][1] = min(d[i-1][0], d[i-2][0]); // 这一层飞了的时间数,和上一层没有飞,以及上上一层没有飞花费的时间数是一样的 } // for(int j=0;j<2;j++){ // for(int i=0;i<n;i++){ // cout<< d[i][j]<<" "; // } // cout<<endl; // } // // if((d[n-1][0]<d[n-1][1])){ // cout<<d[n-1][0]<<" "<<n-1<<" "<<0<<endl; // fun(n-1,0); // }else{ // cout<<d[n-1][1]<<" "<<n-1<<" "<<1<<endl; // fun(n-1,1); // } cout<< min(d[n-1][0],d[n-1][1]) <<endl; } } 伟大的动态规划,我真是愚蠢
Phaser 引擎 中TiledMap 的 json地图配置文件的格式
官方推荐Tiled 地图编辑器, https://www.mapeditor.org/ 所以查看地图格式直接看Tiled 的官方帮助文档 http://doc.mapeditor.org/en/stable/reference/json-map-format/