-
常见的几种页面静态化的方法
2018-09-05 09:35:20常说的页面静态化分为两种,一种是伪静态,即url 重写,一种是真静态化。我们以真静态化为主来讲讲。 什么是PHP静态化 PHP静态化的简单理解就是使网站生成页面以静态HTML的形式展现在访客面前,PHP静态化分纯静态化...常说的页面静态化分为两种,一种是伪静态,即url 重写,一种是真静态化。我们以真静态化为主来讲讲。
什么是PHP静态化
PHP静态化的简单理解就是使网站生成页面以静态HTML的形式展现在访客面前,PHP静态化分纯静态化和伪静态化,两者的区别在于PHP生成静态页面的处理机制不同。
为什么要让网页静态化
一、加快页面打开浏览速度,静态页面无需连接数据库打开速度较动态页面有明显提高;
二、有利于搜索引擎优化SEO,Baidu、Google都会优先收录静态页面,不仅被收录的快还收录的全;
三、减轻服务器负担,浏览网页无需调用系统数据库;
四、网站更安全,HTML页面不会受php相关漏洞的影响; 观看一下大一点的网站基本全是静态页面,而且可以减少攻击,防sql注入。
数据库出错时,不影响网站正常访问。
生成html文章虽操作上麻烦些,程序上繁杂些,但为了更利于搜索,为了速度更快些,更安全,这些牺牲还是值得的。
PHP生成静态HTML页面的方法
利用PHP模板生成静态页面
PHP模板实现静态化非常方便,比如安装和使用PHP Smarty实现网站静态化,也可以自己写一套模板解析规则,常见的可以模仿各类cms的模板规则。
1.使用PHP文件读写功能与ob缓存机制生成静态页面
比如某个商品的动态详情页地址是: http://xxx.com?goods.php?gid=112
那么这里我们根据这个地址读取一次这个详情页的内容,然后保存为静态页,下次有人访问这个商品详情页动态地址时,我们可以
直接把已生成好的对应静态内容文件输出出来。<!--?php $gid = $_GET['gid']+0;//商品id $goods_statis_file = "goods_file_".$gid.".html";//对应静态页文件 $expr = 3600*24*10;//静态文件有效期,十天 if(file_exists($goods_statis_file)){ $file_ctime =filectime($goods_statis_file);//文件创建时间 if($file_ctime+$expr-->time()){//如果没过期 echo file_get_contents($goods_statis_file);//输出静态文件内容 exit; }else{//如果已过期 unlink($goods_statis_file);//删除过期的静态页文件 ob_start(); //从数据库读取数据,并赋值给相关变量 //include ("xxx.html");//加载对应的商品详情页模板 $content = ob_get_contents();//把详情页内容赋值给$content变量 file_put_contents($goods_statis_file,$content);//写入内容到对应静态文件中 ob_end_flush();//输出商品详情页信息 } }else{ ob_start(); //从数据库读取数据,并赋值给相关变量 //include ("xxx.html");//加载对应的商品详情页模板 $content = ob_get_contents();//把详情页内容赋值给$content变量 file_put_contents($goods_statis_file,$content);//写入内容到对应静态文件中 ob_end_flush();//输出商品详情页信息 } ?>
2.使用nosql从内存中读取内容(其实这个已经不算静态化了而是缓存);
以memcache为例:
<!--?php $gid = $_GET['gid']+0;//商品id $goods_statis_content = "goods_content_".$gid;//对应键 $expr = 3600*24*10;//有效期,十天 $mem = new Memcache; $mem--->connect('memcache_host', 11211); $mem_goods_content = $mem->get($goods_statis_content); if($mem_goods_content){ echo $mem_goods_content; }else{ ob_start(); //从数据库读取数据,并赋值给相关变量 //include ("xxx.html");//加载对应的商品详情页模板 $content = ob_get_contents();//把详情页内容赋值给$content变量 $mem->add($goods_statis_content,$content, false, $expr); ob_end_flush();//输出商品详情页信息 } ?>
memcached是键值一一对应,key默认最大不能超过128个字节,value默认大小是1M,因此1M大小满足大多数网页大小的存储。
-
进阶-第26__深度探秘搜索技术_实战掌握四种常见的相关度分数优化方法
2019-03-13 22:17:15之前两节课,我觉得已经很了解整个es的相关度评分的算法了,算法思想,TF/IDF,vector model,...对相关度评分进行调节和优化的常见的4种方法 query-time boost 不添加boost GET /forum/article/_search ...之前两节课,我觉得已经很了解整个es的相关度评分的算法了,算法思想,TF/IDF,vector model,boolean model; 实际的公式,query norm,query coordination,boost
对相关度评分进行调节和优化的常见的4种方法
- query-time boost
不添加boost
GET /forum/article/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"title": {
"query": "java spark"
}
}
},
{
"match": {
"content": "java spark"
}
}
]
}
}
}
结果:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 0.970927,
"hits": [
{
"_index": "forum",
"_type": "article",
"_id": "5",
"_score": 0.970927,
"_source": {
"articleID": "DHJK-B-1395-#Ky5",
"userID": 3,
"hidden": false,
"postDate": "2017-03-01",
"tag": [
"elasticsearch"
],
"tag_cnt": 1,
"view_cnt": 10,
"title": "this is spark blog",
"content": "spark is best big data solution based on scala ,an programming language similar to java spark",
"sub_title": "haha, hello world",
"author_first_name": "Tonny",
"author_last_name": "Peter Smith"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "2",
"_score": 0.8849759,
"_source": {
"articleID": "KDKE-B-9947-#kL5",
"userID": 1,
"hidden": false,
"postDate": "2017-01-02",
"tag": [
"java"
],
"tag_cnt": 1,
"view_cnt": 50,
"title": "this is java blog",
"content": "i think java is the best programming language",
"sub_title": "learned a lot of course",
"author_first_name": "Smith",
"author_last_name": "Williams"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "1",
"_score": 0.26742277,
"_source": {
"articleID": "XHDK-A-1293-#fJ3",
"userID": 1,
"hidden": false,
"postDate": "2017-01-01",
"tag": [
"java",
"hadoop"
],
"tag_cnt": 2,
"view_cnt": 30,
"title": "this is java and elasticsearch blog",
"content": "i like to write best elasticsearch article",
"sub_title": "learning more courses",
"author_first_name": "Peter",
"author_last_name": "Smith"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "4",
"_score": 0.155468,
"_source": {
"articleID": "QQPX-R-3956-#aD8",
"userID": 2,
"hidden": true,
"postDate": "2017-01-02",
"tag": [
"java",
"elasticsearch"
],
"tag_cnt": 2,
"view_cnt": 80,
"title": "this is java, elasticsearch, hadoop blog",
"content": "elasticsearch and hadoop are all very good solution, i am a beginner",
"sub_title": "both of them are good",
"author_first_name": "Robbin",
"author_last_name": "Li"
}
}
]
}
}
Boost 可以将对应的query 的权重增强哦
GET /forum/article/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"title": {
"query": "java spark",
"boost": 2
}
}
},
{
"match": {
"content": "java spark"
}
}
]
}
}
}
结果:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 1.258609,
"hits": [
{
"_index": "forum",
"_type": "article",
"_id": "5",
"_score": 1.258609,
"_source": {
"articleID": "DHJK-B-1395-#Ky5",
"userID": 3,
"hidden": false,
"postDate": "2017-03-01",
"tag": [
"elasticsearch"
],
"tag_cnt": 1,
"view_cnt": 10,
"title": "this is spark blog",
"content": "spark is best big data solution based on scala ,an programming language similar to java spark",
"sub_title": "haha, hello world",
"author_first_name": "Tonny",
"author_last_name": "Peter Smith"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "2",
"_score": 1.083544,
"_source": {
"articleID": "KDKE-B-9947-#kL5",
"userID": 1,
"hidden": false,
"postDate": "2017-01-02",
"tag": [
"java"
],
"tag_cnt": 1,
"view_cnt": 50,
"title": "this is java blog",
"content": "i think java is the best programming language",
"sub_title": "learned a lot of course",
"author_first_name": "Smith",
"author_last_name": "Williams"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "1",
"_score": 0.53484553,
"_source": {
"articleID": "XHDK-A-1293-#fJ3",
"userID": 1,
"hidden": false,
"postDate": "2017-01-01",
"tag": [
"java",
"hadoop"
],
"tag_cnt": 2,
"view_cnt": 30,
"title": "this is java and elasticsearch blog",
"content": "i like to write best elasticsearch article",
"sub_title": "learning more courses",
"author_first_name": "Peter",
"author_last_name": "Smith"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "4",
"_score": 0.310936,
"_source": {
"articleID": "QQPX-R-3956-#aD8",
"userID": 2,
"hidden": true,
"postDate": "2017-01-02",
"tag": [
"java",
"elasticsearch"
],
"tag_cnt": 2,
"view_cnt": 80,
"title": "this is java, elasticsearch, hadoop blog",
"content": "elasticsearch and hadoop are all very good solution, i am a beginner",
"sub_title": "both of them are good",
"author_first_name": "Robbin",
"author_last_name": "Li"
}
}
]
}
}
2、重构查询结构
原本
GET /forum/article/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"content": "java"
}
},
{
"match": {
"content": "spark"
}
},
{
"match": {
"content": "solution"
}
},
{
"match": {
"content": "beginner"
}
}
]
}
}
}
结果:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 1.113083,
"hits": [
{
"_index": "forum",
"_type": "article",
"_id": "4",
"_score": 1.113083,
"_source": {
"articleID": "QQPX-R-3956-#aD8",
"userID": 2,
"hidden": true,
"postDate": "2017-01-02",
"tag": [
"java",
"elasticsearch"
],
"tag_cnt": 2,
"view_cnt": 80,
"title": "this is java, elasticsearch, hadoop blog",
"content": "elasticsearch and hadoop are all very good solution, i am a beginner",
"sub_title": "both of them are good",
"author_first_name": "Robbin",
"author_last_name": "Li"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "5",
"_score": 0.970927,
"_source": {
"articleID": "DHJK-B-1395-#Ky5",
"userID": 3,
"hidden": false,
"postDate": "2017-03-01",
"tag": [
"elasticsearch"
],
"tag_cnt": 1,
"view_cnt": 10,
"title": "this is spark blog",
"content": "spark is best big data solution based on scala ,an programming language similar to java spark",
"sub_title": "haha, hello world",
"author_first_name": "Tonny",
"author_last_name": "Peter Smith"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "2",
"_score": 0.68640786,
"_source": {
"articleID": "KDKE-B-9947-#kL5",
"userID": 1,
"hidden": false,
"postDate": "2017-01-02",
"tag": [
"java"
],
"tag_cnt": 1,
"view_cnt": 50,
"title": "this is java blog",
"content": "i think java is the best programming language",
"sub_title": "learned a lot of course",
"author_first_name": "Smith",
"author_last_name": "Williams"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "3",
"_score": 0.26742277,
"_source": {
"articleID": "JODL-X-1937-#pV7",
"userID": 2,
"hidden": false,
"postDate": "2017-01-01",
"tag": [
"hadoop"
],
"tag_cnt": 1,
"view_cnt": 100,
"title": "this is elasticsearch blog",
"content": "i am only an elasticsearch beginner",
"sub_title": "we have a lot of fun",
"author_first_name": "Jack",
"author_last_name": "Ma"
}
}
]
}
}
重构后
GET /forum/article/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"content": "java" //1/3
}
},
{
"match": {
"content": "spark"//1/3
}
},
{
"bool": {
"should": [
{
"match": {
"content": "solution"//1/6
}
},
{
"match": {
"content": "beginner"//1/6
}
}
]
}
}
]
}
}
}
结果:
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 1.113083,
"hits": [
{
"_index": "forum",
"_type": "article",
"_id": "4",
"_score": 1.113083,
"_source": {
"articleID": "QQPX-R-3956-#aD8",
"userID": 2,
"hidden": true,
"postDate": "2017-01-02",
"tag": [
"java",
"elasticsearch"
],
"tag_cnt": 2,
"view_cnt": 80,
"title": "this is java, elasticsearch, hadoop blog",
"content": "elasticsearch and hadoop are all very good solution, i am a beginner",
"sub_title": "both of them are good",
"author_first_name": "Robbin",
"author_last_name": "Li"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "5",
"_score": 0.970927,
"_source": {
"articleID": "DHJK-B-1395-#Ky5",
"userID": 3,
"hidden": false,
"postDate": "2017-03-01",
"tag": [
"elasticsearch"
],
"tag_cnt": 1,
"view_cnt": 10,
"title": "this is spark blog",
"content": "spark is best big data solution based on scala ,an programming language similar to java spark",
"sub_title": "haha, hello world",
"author_first_name": "Tonny",
"author_last_name": "Peter Smith"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "2",
"_score": 0.68640786,
"_source": {
"articleID": "KDKE-B-9947-#kL5",
"userID": 1,
"hidden": false,
"postDate": "2017-01-02",
"tag": [
"java"
],
"tag_cnt": 1,
"view_cnt": 50,
"title": "this is java blog",
"content": "i think java is the best programming language",
"sub_title": "learned a lot of course",
"author_first_name": "Smith",
"author_last_name": "Williams"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "3",
"_score": 0.26742277,
"_source": {
"articleID": "JODL-X-1937-#pV7",
"userID": 2,
"hidden": false,
"postDate": "2017-01-01",
"tag": [
"hadoop"
],
"tag_cnt": 1,
"view_cnt": 100,
"title": "this is elasticsearch blog",
"content": "i am only an elasticsearch beginner",
"sub_title": "we have a lot of fun",
"author_first_name": "Jack",
"author_last_name": "Ma"
}
}
]
}
}
重构查询结果,达到调节不同query的比重,在es新版本中,影响越来越小了。一般情况下,没什么必要的话,大家不用也行。
3、negative boost
包含java 不包含spark
GET /forum/article/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"content": "java"
}
}
],
"must_not": [
{
"match": {
"content": "spark"
}
}
]
}
}
}
结果:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.68640786,
"hits": [
{
"_index": "forum",
"_type": "article",
"_id": "2",
"_score": 0.68640786,
"_source": {
"articleID": "KDKE-B-9947-#kL5",
"userID": 1,
"hidden": false,
"postDate": "2017-01-02",
"tag": [
"java"
],
"tag_cnt": 1,
"view_cnt": 50,
"title": "this is java blog",
"content": "i think java is the best programming language",
"sub_title": "learned a lot of course",
"author_first_name": "Smith",
"author_last_name": "Williams"
}
}
]
}
}
包含java,尽量不包含spark
搜索包含java,不包含spark的doc,但是这样子很死板(会导致spark 的doc的就没了)
搜索包含java,尽量不包含spark的doc,如果包含了spark,不会说排除掉这个doc,而是说将这个doc的分数降低
包含了negative(反搜索) term的doc,分数乘以negative boost,分数降低
GET /forum/article/_search
{
"query": {
"boosting": {
"positive": {
"match": {
"content": "java"
}
},
"negative": {
"match": {
"content": "spark"
}
},
"negative_boost": 0.2
}
}
}
结果:
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 0.68640786,
"hits": [
{
"_index": "forum",
"_type": "article",
"_id": "2",
"_score": 0.68640786,
"_source": {
"articleID": "KDKE-B-9947-#kL5",
"userID": 1,
"hidden": false,
"postDate": "2017-01-02",
"tag": [
"java"
],
"tag_cnt": 1,
"view_cnt": 50,
"title": "this is java blog",
"content": "i think java is the best programming language",
"sub_title": "learned a lot of course",
"author_first_name": "Smith",
"author_last_name": "Williams"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "5",
"_score": 0.05753642,
"_source": {
"articleID": "DHJK-B-1395-#Ky5",
"userID": 3,
"hidden": false,
"postDate": "2017-03-01",
"tag": [
"elasticsearch"
],
"tag_cnt": 1,
"view_cnt": 10,
"title": "this is spark blog",
"content": "spark is best big data solution based on scala ,an programming language similar to java spark",
"sub_title": "haha, hello world",
"author_first_name": "Tonny",
"author_last_name": "Peter Smith"
}
}
]
}
}
negative的doc,会乘以negative_boost,降低分数
4、constant_score
GET /forum/article/_search
{
"query": {
"bool": {
"should": [
{
"constant_score": {
"query": {
"match": {
"title": "java"
}
}
}
},
{
"constant_score": {
"query": {
"match": {
"title": "spark"
}
}
}
}
]
}
}
}
结果:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 1,
"hits": [
{
"_index": "forum",
"_type": "article",
"_id": "5",
"_score": 1,
"_source": {
"articleID": "DHJK-B-1395-#Ky5",
"userID": 3,
"hidden": false,
"postDate": "2017-03-01",
"tag": [
"elasticsearch"
],
"tag_cnt": 1,
"view_cnt": 10,
"title": "this is spark blog",
"content": "spark is best big data solution based on scala ,an programming language similar to java spark",
"sub_title": "haha, hello world",
"author_first_name": "Tonny",
"author_last_name": "Peter Smith"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "2",
"_score": 1,
"_source": {
"articleID": "KDKE-B-9947-#kL5",
"userID": 1,
"hidden": false,
"postDate": "2017-01-02",
"tag": [
"java"
],
"tag_cnt": 1,
"view_cnt": 50,
"title": "this is java blog",
"content": "i think java is the best programming language",
"sub_title": "learned a lot of course",
"author_first_name": "Smith",
"author_last_name": "Williams"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "4",
"_score": 1,
"_source": {
"articleID": "QQPX-R-3956-#aD8",
"userID": 2,
"hidden": true,
"postDate": "2017-01-02",
"tag": [
"java",
"elasticsearch"
],
"tag_cnt": 2,
"view_cnt": 80,
"title": "this is java, elasticsearch, hadoop blog",
"content": "elasticsearch and hadoop are all very good solution, i am a beginner",
"sub_title": "both of them are good",
"author_first_name": "Robbin",
"author_last_name": "Li"
}
},
{
"_index": "forum",
"_type": "article",
"_id": "1",
"_score": 1,
"_source": {
"articleID": "XHDK-A-1293-#fJ3",
"userID": 1,
"hidden": false,
"postDate": "2017-01-01",
"tag": [
"java",
"hadoop"
],
"tag_cnt": 2,
"view_cnt": 30,
"title": "this is java and elasticsearch blog",
"content": "i like to write best elasticsearch article",
"sub_title": "learning more courses",
"author_first_name": "Peter",
"author_last_name": "Smith"
}
}
]
}
}
如果你压根儿不需要相关度评分,直接走constant_score加filter,所有的doc分数都是1,没有评分的概念了
-
win10环境下MySQL服务常见的两种开启方式
2019-08-19 08:43:50本博客将在win10+MySQL5.7的环境下,演示一些MySQL服务的两种开启方式。 MySQL服务的开启、关闭 这一步很有必要,有时当你打开一些数据库图形操作界面,会报错说无法连接,这一般都是MySQL服务没有开启的锅。 方法一...本博客将在win10+MySQL5.7的环境下,演示一些MySQL服务的两种开启方式。
MySQL服务的开启、关闭
这一步很有必要,有时当你打开一些数据库图形操作界面,会报错说无法连接,这一般都是MySQL服务没有开启的锅。
方法一、通过系统“服务”图形界面进行开启。
①、点击win10的搜索助手,或者快捷键win+q开启。
②、在搜索栏输入“服务”,查找系统应用,并双击进入。
③、查看MySQL服务是否开启。
如果状态显示“正在运行”,说明服务已经开启。如果是状态如图显示空白,说明MySQL服务没有开启,需要将它打开。
④、开启MySQL服务。
双击选中的MySQL服务项,来到详细信息界面。
点击“启动”,即可开启MySQL服务。
如果你觉得手动开启MySQL服务有些繁琐,可以将它设置为开机自启。
⑤、MySQL服务的关闭。
点击停止即可。方法二、通过命令行开启、关闭MySQL服务。
①、通过win + R组合快捷键打开运行界面,并输入cmd,来到终端
②、输入命令net start mysql服务名
并敲下回车,开启MySQL服务。(注意这里的MySQL服务名是你安装的时候设置的,上面的图形化界面“服务”中可以查看。)
可以看到,MySQL服务已经开启。③、MySQL服务的关闭,输入命令
net stop mysql服务名
并敲下回车,开启MySQL服务。(注意这里的MySQL服务名是你安装的时候设置的,上面的图形化界面“服务”中可以查看。)
可以看到,MySQL服务已经关闭。如果提示
net start mysql 发生系统错误 5。 拒绝访问。
我们需要以管理员方式运行cmd程序。
然后重新打开一个cmd窗口即可运行上面的net start、stop命令。至此win10系统下两种常见的MySQL服务开启方式全部介绍完毕,读者可以根据自己的喜好进行选择,建议使用命令行的方式,简单一些。
-
上传代码到git的两种基本方式以及常见的错误
2020-07-20 00:16:38本人是刚刚使用git的一个小白,最开始第一次上传的时候很崩溃,在几次上传代码到git的过程中,都出现了各种各样的错误,在网上搜索时,也发现没有很具体的关于如何上传代码到git的博客,大部分博客侧重于介绍如何...本人是刚刚使用git的一个小白,最开始第一次上传的时候很崩溃,在几次上传代码到git的过程中,都出现了各种各样的错误,在网上搜索时,也发现没有很具体的关于如何上传代码到git的博客,大部分博客侧重于介绍如何安装注册git以及建立仓库。我的这篇博客主要介绍如何上传代码到git ,希望可以对刚刚接触git的人带来一些帮助
本篇文章的前提是你在git上已经新建了一个仓库,假设它的链接是https://github.com/eggg369/test.git
方法一
1. cd /Users/XXX/Desktop/ 2. git clone https://github.com/eggg369/test.git (在桌面上克隆了一个git上的文件,我们称它为test) 3. 直接将写代码的文件建立在克隆到桌面的文件夹里,并且写一点代码 4. cd /Users/XXX/Desktop/test 5. git status (看一下文件夹里都有啥) 6. git add . 7. git commit -m ""(""里是添加有关描述) 8. git push
更详细的请看截图
第一句是cd /Users/XXX/Desktop/(没有截上)
下面为要说一下这种方法,
9. 优点: 它很适合第一次创建项目的时候来使用
10. 缺点: 如果你第二天继续写了一个项目想要上传上去,除非你没有动过终端,还是和远程仓库是链接着的,才可以传上去,当然这样第二次传直接重复第4到8步就好,但是很多时候你需要重复操作以上所有过程,很不方便,而且这样你的电脑桌面上会有一堆克隆的文件,很难清理。方法二
11. cd /Users/guohongle/Documents/网易云( 这是你要上传到git上的文件夹) 12. git status (可以没有这一步,这是为了查看文件夹里的文件,此时应该都是红的) 13. git init (创建.git文件,生成暂存区) 14. git add . 15. git commit -m "网易云" 16. git status (可以没有这一步,此时git atatus 本地是空的了,显示On branch master nothing to commit, working tree clean 17. git remote add origin https://github.com/eggg369/test.git (链接远程仓库) 18. git remove -v (可以查看一下) 19. git push (如果有错,一般第一次都会出错,执行下一步) 20. git pull --rebase origin master 21. git push -u origin master
截图更清楚
下面来说一下我对这种方法的理解- 缺点: 第一次上传代码不建议用这种方法,因为最后一步一般还需要pull一下
- 优点:可以直接把你的文件上传到远程仓库,不需要克隆到桌面,尤其在第二次想上传到同一个仓库的时候,不需要新建一个仓库,直接remove链接就可以了,如果已经链接,它会提醒你的,然后只需要add, commit, push就可以了
我在上传时遇到的一些错误
- git status时出现错误
- you are not currently on a branch
- push 时出现错误``
error: failed to push some refs to 'https://github.com/egggg369/-.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
以上是我遇到过的几个错误,如果遇见了其他错误,我会不定期更新的
在这里截图引用了几个博客,很抱歉我当时截图的时候忘记了记录你们的博客链接,如果有看到可以联系我,我会在博客后面添加一下你们的博客链接的,谢谢!!
希望我的方法对小白们有一些帮助! -
两种常见问题优化
2013-11-06 17:01:00正确的优化才能让网站被搜索引擎所喜欢,但是还有一些人在优化网站时虽说是使用正常的方法在优化,但是网站优化效果还是不好,为什么会出现这样的问题,seo公司对此进行了一定的分析。 优化效果问题 一些网站长... -
如何用邻接表法表示一张图&图的两种搜索方式
2020-04-26 12:33:50图的表示方法有很多,这里有一种比较常见的用法:邻接表法,它的实现往往在竞赛中不用链表,而是通过vector动态数组实现 表示方法: vector<int>a[10];//表示有10个结点,其中每个结点对应的vector里存放与它... -
cad添加自己线性_创建cad线型的两种方法(线型文件和linetype) - CAD自学网
2020-12-30 18:32:03建立新线型有两种方法:直接修改线型文档和通过命令。修改线型.LIN文档该方法相较通过命令定义易掌握。CAD图标右键,在级联菜单中选择“打开文件位置”。打开后,在文件夹中搜索.lin扩展名文件。会找到... -
算法合集之《信息学竞赛中搜索问题的常见优化技巧》.pdf
2020-07-04 08:31:452006 年全国信息学冬令营讲座 信息学竞赛中...关键词信息学搜索顺序搜索对象Hash 表 5 剪枝 在信息学竞赛中解决搜索问题通常采用两种方法进行即深度优先搜索和广度 优先搜索 一深度优先搜索的优化技巧 我们在做题的时 -
搜索中两种高亮显示方式
2013-01-23 14:15:30以下提供常见两种方式处理搜索时高亮显示。目前鉴于商麦系统中大量字段没有保存。solr返回ID。所以建议采用第一种方式处理。 处理方式为通过velocity模板工具注入工具类,提供静态方法。进行解析。达到高亮显示。 ... -
mongodb 搜索速度_性能 – MongoDB文本索引搜索大表中常见单词的速度慢
2021-01-12 01:15:19我正在为一个服务提供mongodb数据库,该服务支持对具有680万条记录的集合进行全文搜索.其文本索引包括十个具有...当在搜索查询中使用索引中非常常见的单词时,搜索需要15-60秒.我似乎文本搜索功能不支持延迟参数.我的... -
搜索引擎的查询方法
2010-11-18 22:03:00另一类是基于Web目录的分类查询方法,虽然功能略逊于前者,但是也有自己的优势,而且这两种方法还可以结合使用。本章对此分别予以介绍,并在最后讨论一些常见的查询策略和典型案例。 1.1 基于关键词的基本查询方法 ... -
常见的CSS隐藏文字方法(转)
2010-01-29 16:20:00对于隐藏文字 & 内容,网上已有不少CSS方法可以实现,现总结.../* 它可以使包括容器本身在内的东西都消失,简便且有效,但它有两个耳熟能详的缺陷,那就是对搜索引擎不友好,且被屏幕阅读器所忽略。将对象完全性隐藏。 -
Python安装模块(numpy等)问题的两种解决办法——常规方法和Anaconda
2017-08-04 11:32:55常见模块安装问题Python是现在最顶尖的几个研究方向(人工智能、机器学习等)的主流编程语言,博主因为要参加竞赛也需要学习Python(主要是科学计算方面),现阶段会用到的模块有numpy、scipy、matplotlib及scikit-... -
ADDXP安装集成库的两种情况
2020-05-15 14:58:161.intLib库的安装方法 第一种安装intlib库,非常常见,这种库的结尾都是.intlib...3.两种库的查看方法 但是我们在库的查看时,也要注意相关选项; 只有勾选器件和封装才能显示我们安装的这两种库; 不然只勾选器件,只 -
Java中Collections的几种常用方法
2019-08-21 20:21:49今天对Collections的集中常见方法进行了代码运用 1) 排序(Sort) 2) 混排(Shuffling) 3) 反转(Reverse) 4) 替换所有的元素(Fill) 5) 拷贝(Copy) 6) 返回Collections中最小元素(min) 7) 返回... -
Python之string模块(详细讲述string常见的所有方法)
2019-10-15 09:32:32相信不少学习python的程序员都接触过string模块 string模块主要包含关于字符串的处理函数 ...大小写转化在整个string操作中还是比较重要的,主要分三种类型 第一种:全部大小写转化upper()与lower() 两个函数... -
【数据结构】二叉搜索树的概念和常见操作
2020-02-16 14:35:56在静态查找中有一种很快的查找方法(二分查找时间复杂度为O( log(n) )。它之所以可以将时间复杂度降的这么低,是因为在查找之前对数据进行了顺序的排序。在查找时查找的顺序是固定的,是一个判定树一样的结构。把一... -
android实现图片闪烁动画效果的两种实现方式(实用性高)
2021-01-04 04:06:19其实实现这种动画效果有很多种方法,最常见的是两种:第一种就是插入n张图片进行切换已达到如此目的,第二种就是通过改变一张图片的透明度来达到闪烁的效果。下面就分别讲一下通过这两种方法如何实现。 第一种:... -
几种常见取石子模型
2018-04-02 15:54:21几种常见取石子模型上次做poj 1067的取石子游戏,只用到了whthoff博弈,未涉及到取石子的异或方法,今天重新搜索,整理了一遍。搜罗各种资料,加上自己整理,终于成篇啦!……噼里啪啦 取石子问题有一种很有意思的... -
epic登录错误恢复_Apple ID 共享账号使用方法(Mac系统)、登录异常以及常见问题的解决方法...
2021-01-15 08:06:50登录及下载打开AppStore,点击菜单栏『商店』,点击...AppStore 中的应用分为两种:一种是永久版的,下载完就可以用,另一种是订阅制的,订阅制也就是有内购的,如果下载完运行后还是试用版,那就是内购的,这种... -
论文研究 - 与健康相关的互联网信息既增强又削弱了父母的自我照顾潜力-基于父母搜索方式的混合方法研究
2020-05-25 05:15:29父母通常使用Google搜索来搜索特定主题,从而开始Internet搜索,但是最常见和使用最多的网站(由95%的父母使用)是瑞典卫生网站1177.se。 98.4%的父母认为他们在互联网上进行的一般信息搜索是可靠的,尽管只有31... -
常见JS挂马方法及如何防止网站被黑客挂马?
2016-03-09 14:38:00最近有朋友说自己的网站平时并未作弊,文章也都是原创的,更新很稳定。可不知道为什么网站突然就被各...现在最多见的JS挂马方法有两种,一种是直接将JavaScript脚本代码写在网页中,当访问者在浏览网页时,恶意的挂... -
WebService中使用自定义类的解决方法(5种)
2019-08-20 15:01:35Demo下载:http://www.cnblogs.com/Files/lxinxuan/wa.rar 最近一个项目要用到webservice调用业务层类,刚开始的时候遇到了一点小麻烦,经过这两天的总结和实践,终于总结出几个比较常见的情况下的解决方法。... -
论文研究 - 基于外周血基因表达的早期非小细胞肺癌的两种分子标记
2020-06-02 17:56:21背景:肺癌是最常见的癌症之一。 正在进行搜索以寻找生物标记物以改善早期诊断肺癌的技术。 在这项研究中,我们评估了非小细胞肺癌(NSCLC)外周血中MUC1和CEA基因表达的敏感性和特异性。 材料和方法:这项研究是在... -
WebService中传输自定义类的5种解决方法(转)
2010-06-22 16:15:00最近一个项目要用到webservice调用业务层类,刚开始的时候遇到了一点小麻烦,经过这两天的总结和实践,终于总结出几个比较常见的情况下的解决方法。 不知道大家是怎么解决,可能太简单了,所以没有觉得它是一个问题...
-
DNAMAN.exe
-
机器学习可视化软件机器学习可视化软件
-
洛谷P1603 斯诺登的密码经典解法
-
【硬核】一线Python程序员实战经验分享(1)
-
2016 年中级通信工程师考试综合能力真题.pdf
-
洛谷P5738 【深基7.例4】歌唱比赛经典解法
-
自动化测试Python3+Selenium3+Unittest
-
马士兵老师spring框架学习笔记
-
2019年-华启学院中级通信工程师综合能力真题及答案(完整版).pdf
-
MMM 集群部署实现 MySQL 高可用和读写分离
-
DES的ECB加密解密汇总.zip
-
带头节点,输出循环单链表中的最小值并删除节点,直至空链表,删除队头
-
阿伦尼斯模型研究.pdf
-
jdk8u281.zip
-
2016通信中级互联网真题.pdf
-
NodeMCU-ESP32开发实例-WiFi连接设置静态IP
-
C语言零基础入门(详细讲解)
-
12. 最大值.cpp
-
HP_M1130_M1210_MFP_Full_Solution-v20180815-10158769.rar
-
L2-020 功夫传人 (25 分)