1 #region * 在一个TR中,解析TD,获取一期的号码
2 ///
3 /// 在一个TR中,解析TD,获取一期的号码
4 ///
5 ///
6 ///
7 private void ResolveTd(ref WinNo wn, string trContent)
8 {
9 List<int > redBoxList = null ;
10 // 匹配期号的表达式
11 string patternQiHao = " " ;
12 Regex regex = new Regex(patternQiHao);
13 Match qhMatch = regex.Match(trContent);
14 wn.QiHao = trContent.Substring(qhMatch.Index + 17 + patternQiHao.Length, 7 );
15 // 匹配蓝球的表达式
16 string patternChartBall02 = " " ;
17 regex = new Regex(patternChartBall02);
18 Match bMatch = regex.Match(trContent);
19 wn.B = Convert.ToInt32(trContent.Substring(bMatch.Index + patternChartBall02.Length, 2 ));
20 // 存放匹配出来的红球号码
21 redBoxList = new List<int >();
22 // 匹配红球的表达式
23 string patternChartBall01 = " " ;
24 regex = new Regex(patternChartBall01);
25 MatchCollection rMatches = regex.Matches(trContent);
26 foreach (Match r in rMatches)
27 {
28 redBoxList.Add(Convert.ToInt32(trContent.Substring(r.Index + patternChartBall01.Length, 2 )));
29 }
30 // 匹配红球的表达式
31 string patternChartBall07 = " " ;
32 regex = new Regex(patternChartBall07);
33 rMatches = regex.Matches(trContent);
34 foreach (Match r in rMatches)
35 {
36 redBoxList.Add(Convert.ToInt32(trContent.Substring(r.Index + patternChartBall07.Length, 2 )));
37 }
38 // 排序红球号码
39 redBoxList.Sort();
40 // 第一个红球号码
41 wn.R1 = redBoxList[0 ];
42 // 第二个红球号码
43 wn.R2 = redBoxList[1 ];
44 wn.R3 = redBoxList[2 ];
45 wn.R4 = redBoxList[3 ];
46 wn.R5 = redBoxList[4 ];
47 wn.R6 = redBoxList[5 ];
48 }
下面这块的代码是某招聘网站的截取数据,就是一串的截取HTML标签的内容,哈哈,当时在写这个时候相当的头痛,不知有做个这方法工作的人是不是有同感,当你解析比较多网站的数据就更加了(我写了抓取前程无忧、猎聘网、前程无忧和拉勾网的数据),O(∩_∩)O哈哈~想死呀,使用正则表达是去截取数据,再去提取相应信息的工作。
// 正则表达式过滤:正则表达式,要替换成的文本
private static readonly string [][] Filters =
{
new [] { @" (?is).*? " , "" },
new [] { @" (?is).*? " , "" },
new [] { @" (?is) " , "" }, // 过滤Html代码中的注释
new [] { @" (?is).*? " ,"" },
// new[] { "(?is).*?
",""}
new [] { @" (?is)常用链接:.*? " ,"" }
};
private void GetJobInfoFromUrl(string url)
{
try
{
JobInfo info = new JobInfo();
// --
string pageStr = GetHtmlCode.GetByget(url, " utf-8 " );
if (string .IsNullOrEmpty(pageStr))
{
return ;
}
// --
pageStr = pageStr.Replace(" \r\n " , "" );// 替换换行符
// 获取html,body标签内容
string body = string .Empty;
string bodyFilter = @" (?is) " ;
Match m = Regex.Match(pageStr, bodyFilter);
if (m.Success)
{
body = m.ToString().Replace(" " , " " ).Replace(" \r\n " , "" );
}
// 过滤样式,脚本等不相干标签
foreach (var filter in Filters)
{
body = Regex.Replace(body, filter[0 ], filter[1 ]);
}
// --
if (!string .IsNullOrEmpty(mustKey) && !body.Contains(mustKey))
{
return ;
}
body = Regex.Replace(body, " \\s " , "" );
info.Url = url;
string basicInfoRegexStr0 = " (.*?) " ; // 职位名称
string position = Regex.Match(body, basicInfoRegexStr0).Value;
info.Position = string .IsNullOrEmpty(position) ? "" : position.Substring(position.IndexOf(" > " ) + 1 , position.IndexOf(" " ) - position.IndexOf(" > " ) - 1 );// 职位名称
string basicInfoRegexStr1 = " (.*?) " ;// 公司名称
string company = Regex.Match(body, basicInfoRegexStr1).Value;
info.Company = string .IsNullOrEmpty(company) ? "" : company.Substring(company.IndexOf(" " ) + 4 , company.IndexOf(" " ) - company.IndexOf(" " ) - 4 );// 公司名称
string basicInfoRegexStr2 = " (.*?) " ;// 工作地点
string address = Regex.Match(body, basicInfoRegexStr2).Value;
info.Address = string .IsNullOrEmpty(address) ? "" : address.Substring(address.IndexOf(" " ) + 6 , address.IndexOf(" " ) - address.IndexOf(" " ) - 6 );// 工作地点
string basicInfoRegexStr3 = " 企业性质: (.*?)" ;// 公司性质
string nature = Regex.Match(body, basicInfoRegexStr3).Value;
info.Nature = string .IsNullOrEmpty(nature) ? "" : nature.Substring(nature.IndexOf(" " ) + 7 , nature.IndexOf(" " ) - nature.IndexOf(" " ) - 7 );// 公司性质
if (string .IsNullOrEmpty(info.Nature))
{
string basicInfoRegexStr3_1 = " 性质: (.*?)" ;
string nature_1 = Regex.Match(body, basicInfoRegexStr3_1).Value;
info.Nature = string .IsNullOrEmpty(nature_1) ? "" : nature_1.Substring(nature_1.IndexOf(" " ) + 7 , nature_1.LastIndexOf(" " ) - nature_1.IndexOf(" " ) - 7 );// 公司性质
}
string basicInfoRegexStr4 = " 企业规模: (.*?)" ;// 公司规模
string scale = Regex.Match(body, basicInfoRegexStr4).Value;
info.Scale = string .IsNullOrEmpty(scale) ? "" : scale.Substring(scale.IndexOf(" " ) + 7 , scale.IndexOf(" " ) - scale.IndexOf(" " ) - 7 );// 公司规模
if (string .IsNullOrEmpty(info.Scale))
{
string basicInfoRegexStr4_1 = " 规模: (.*?)" ;
string scale_1 = Regex.Match(body, basicInfoRegexStr4_1).Value;
info.Scale = info.Nature = string .IsNullOrEmpty(scale_1) ? "" : scale_1.Substring(scale_1.IndexOf(" " ) + 7 , scale_1.LastIndexOf(" " ) - scale_1.IndexOf(" " ) - 7 );// 公司规模
}
string basicInfoRegexStr5 = " (.*?) " ;// 工作经验
string experience = Regex.Match(body, basicInfoRegexStr5).Value;
info.Experience = string .IsNullOrEmpty(experience) ? "" : experience.Substring(experience.IndexOf(" > " ) + 1 , experience.IndexOf(" " ) - experience.IndexOf(" > " ) - 1 );// 工作经验
string basicInfoRegexStr6 = " (.*?) " ;// 最低学历
string education = Regex.Match(body, basicInfoRegexStr6).Value;
info.Education = string .IsNullOrEmpty(education) ? "" : education.Substring(education.IndexOf(" " ) + 6 , education.IndexOf(" " ) - education.IndexOf(" " ) - 6 );// 最低学历
string basicInfoRegexStr7 = " (.*?)< " ;// 月薪
string salary = Regex.Match(body, basicInfoRegexStr7).Value;
info.Salary = string .IsNullOrEmpty(salary) ? "" : salary.Substring(salary.IndexOf(" > " ) + 1 , salary.LastIndexOf(" < " ) - salary.IndexOf(" > " ) - 1 );// 月薪
string timeInfoRegexStr = " 发布时间:(.*?) " ;// 发布时间
string time = Regex.Match(body, timeInfoRegexStr).Value;
info.Time = string .IsNullOrEmpty(time) ? "" : time.Substring(time.IndexOf(" " ) + 4 , time.IndexOf(" " ) - time.IndexOf(" " ) - 4 );// 发布时间
if (GetJobEnd != null )
{
GetJobEnd(pageStr, info);
}
}
catch (Exception exMsg)
{
throw new Exception(exMsg.Message);
}
}
}
从以上代码可以看出都是在截取(正则表达式)相应内容,非常复杂,稍微一不注意就截取不到网站数据,写起来相当的费劲,最后通过QQ群(186841119 )里的朋友的介绍采用了Fizzler来提取网站数据,一下子感觉就容易多了,下面着中来介绍一下Fizzler这个工具(好像这个是开源的),相关介绍可以去网站查询到。
首先提供这个工具的下载地址:Fizzler
这个里面包括三个文件:Fizzler.dll、Fizzler.Systems.HtmlAgilityPack.dll、HtmlAgilityPack.dll三个文件,在VS2010里引用里直接进行引用就可以了。
完成以上即完成了对Fizzler的引用。
using HtmlAgilityPack;
using Fizzler;
using Fizzler.Systems.HtmlAgilityPack;
以上就可以在CS里进行了引用,
下面来进行代码的实现,
private static WebDownloader m_wd = new WebDownloader();
///
/// 获取HTML内容
///
/// 链接
/// 字符集
///
public static string GetHtml(string Url, Encoding Code)
{
return m_wd.GetPageByHttpWebRequest(Url, Code);
}
public string GetPageByHttpWebRequest(string url, Encoding encoding)
{
Stream sr = null ;
StreamReader sReader = null ;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = " Get " ;
request.Timeout = 30000 ;
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
if (response.ContentEncoding.ToLower() == " gzip " )// 如果使用了GZip则先解压
{
sr = new GZipStream(response.GetResponseStream(), CompressionMode.Decompress);
}
else
{
sr = response.GetResponseStream();
}
sReader = new StreamReader(sr, encoding);
return sReader.ReadToEnd();
}
catch
{
return null ;
}
finally
{
if (sReader != null )
sReader.Close();
if (sr != null )
sr.Close();
}
}
以上即实现抓取HTML数据代码,,以上代码基本上也没啥区别,就是普通抓取数据的方法。
///
/// 获取相应的标签内容
///
/// 链接
/// CSS路径
/// 字符集
///
public static IEnumerable GetUrlInfo(string Url, string CSSLoad, Encoding Code)
{
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument
{
OptionAddDebuggingAttributes = false ,
OptionAutoCloseOnEnd = true ,
OptionFixNestedTags = true ,
OptionReadEncoding = true
};
htmlDoc.LoadHtml(GetHtml(Url, Code));
IEnumerable NodesMainContent = htmlDoc.DocumentNode.QuerySelectorAll(CSSLoad);// 查询的路径
return NodesMainContent;
}
///
/// 获取相应的标签内容
///
/// html内容
/// CSS路径
///
public static IEnumerable GetHtmlInfo(string html, string CSSLoad)
{
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument
{
OptionAddDebuggingAttributes = false ,
OptionAutoCloseOnEnd = true ,
OptionFixNestedTags = true ,
OptionReadEncoding = true
};
htmlDoc.LoadHtml(html);
IEnumerable NodesMainContent = htmlDoc.DocumentNode.QuerySelectorAll(CSSLoad);// 查询的路径
return NodesMainContent;
}
以上两个方法即实现对相应路径标签数据的抓取,一个方法是根据URL进行抓取,一个是根据HTML内容去抓取相应的数据,下面着重介绍CSSLoad的获取方法,这个需要安装火狐浏览器即可,火狐浏览器需要安装FireBug插件进行查询,如下图(网站工具栏):
再点击像蜘蛛一样的图标,这样可以看到如下:
这样可以看到所有的HTML标签,那么紧接着如何去获取CSS路径呢,那相对来说就非常简单了。
点击蓝色的箭头选取网站相关的内容,
这样相应的HTML同样选中了,这样离我们拿到CCS路径更近一步了,紧接着点击右键即可复制CCS路径即可。如下:
点击复制CSS路径就可以了,复制出CSS路径如下:
html body#Posts form#frmMain table#BodyTable tbody tr td#Body div#Main div#Editor_Edit div#Editor_Edit_Contents div#edit_container div#Editor_Edit_APOptions div#Editor_Edit_APOptions_Contents.Edit div.edit_option div#Editor_Edit_APOptions_Advancedpanel1 div#Editor_Edit_APOptions_Advancedpanel1_Header.subCollapsibleTitle
看到这一串路径别急,我们也不需要把这串路径全部复制到我们程序里,否则这样显得太负责了,我们只需要将最后的部分节点放到上面的方法里面,我们就能读取到HTML标签相应的内容,下面举一个简单例子就进行说明。
1 ///
2 /// 解析每一条招聘信息
3 ///
4 ///
5 private void GetJobInfoFromUrl(object Url)
6 {
7 try
8 {
9 JobInfo info = new JobInfo();
10 info.Url = Url.ToString();
11 // --获取HTML内容
12 string html =AnalyzeHTML.GetHtml(Url.ToString(), Encoding.UTF8);
13 if (string .IsNullOrEmpty(html)) { return ; }
14 // --职位名称
15 IEnumerable NodesMainContent1 = AnalyzeHTML.GetHtmlInfo(html, " div.title-info h1 " );
16 if (NodesMainContent1.Count()>0 )
17 {
18 info.Position = NodesMainContent1.ToArray()[0 ].InnerText;
19 }
20 // --公司名称
21 IEnumerable NodesMainContent2 = AnalyzeHTML.GetHtmlInfo(html, " div.title-info h3 " );
22 if (NodesMainContent2.Count() > 0 )
23 {
24 info.Company = NodesMainContent2.ToArray()[0 ].InnerText;
25 }
26 // --公司性质/公司规模
27 IEnumerable NodesMainContent4 = AnalyzeHTML.GetHtmlInfo(html, " div.content.content-word ul li " );
28 if (NodesMainContent4.Count() > 0 )
29 {
30 foreach (var item in NodesMainContent4)
31 {
32 if (item.InnerHtml.Contains(" 企业性质 " ))
33 {
34 string nature = item.InnerText;
35 nature = nature.Replace(" 企业性质: " , "" );
36 info.Nature = nature;
37 }
38 if (item.InnerHtml.Contains(" 企业规模 " ))
39 {
40 string scale = item.InnerText;
41 scale = scale.Replace(" 企业规模: " , "" );
42 info.Scale = scale;
43 }
44 }
45 }
46 else // 第二次解析企业性质和企业规模
47 {
48 IEnumerable NodesMainContent4_1 = AnalyzeHTML.GetHtmlInfo(html, " div.right-post-top div.content.content-word " );
49 if (NodesMainContent4_1.Count() > 0 )
50 {
51 foreach (var item_1 in NodesMainContent4_1)
52 {
53 string [] arr = item_1.InnerText.Split(" \r\n " .ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
54 if (arr != null && arr.Length > 0 )
55 {
56 foreach (string str in arr)
57 {
58 if (str.Trim().Contains(" 性质 " ))
59 {
60 info.Nature = str.Replace(" 性质: " , "" ).Trim();
61 }
62 if (str.Trim().Contains(" 规模 " ))
63 {
64 info.Scale = str.Replace(" 规模: " , "" ).Trim();
65 }
66 }
67 }
68 }
69 }
70 }
71 // --工作经验
72 IEnumerable NodesMainContent5 = AnalyzeHTML.GetHtmlInfo(html, " div.resume.clearfix span.noborder " );
73 if (NodesMainContent5.Count() > 0 )
74 {
75 info.Experience = NodesMainContent5.ToArray()[0 ].InnerText;
76 }
77 // --公司地址/最低学历
78 IEnumerable NodesMainContent6 = AnalyzeHTML.GetHtmlInfo(html, " div.resume.clearfix " );
79 if (NodesMainContent6.Count() > 0 )
80 {
81 foreach (var item in NodesMainContent6)
82 {
83 string lable = Regex.Replace(item.InnerHtml, " \\s " , "" );
84 lable = lable.Replace(" " , "" );
85 string [] arr = lable.Split(" " .ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
86 if (arr != null && arr.Length > 2 )
87 {
88 info.Address = arr[0 ];// 公司地址
89 info.Education = arr[1 ];// 最低学历
90 }
91 }
92 }
93 // --月薪
94 IEnumerable NodesMainContent7 = AnalyzeHTML.GetHtmlInfo(html, " div.job-title-left p.job-main-title " );
95 if (NodesMainContent7.Count() > 0 )
96 {
97 info.Salary = NodesMainContent7.ToArray()[0 ].InnerText;
98 }
99 // --发布时间
100 IEnumerable NodesMainContent8 = AnalyzeHTML.GetHtmlInfo(html, " div.job-title-left p.release-time em " );
101 if (NodesMainContent8.Count() > 0 )
102 {
103 info.Time = NodesMainContent8.ToArray()[0 ].InnerText;
104 }
105 // --
106 if (GetJobEnd != null )
107 {
108 GetJobEnd("" , info);
109 }
110 }
111 catch (Exception exMsg)
112 {
113 throw new Exception(exMsg.Message);
114 }
115 }
以上这个方法也是解析某招聘网站标签的内容,但已经看不到复杂的正则表达式去截取HTML标签了,这样显得代码更加干练、简单,再整一个配置页面既可应付抓取网站标签经常变化的难题,这样就显得抓取别人网站数据就是一件非常简单的事情了,O(∩_∩)O哈哈~是不是啦!!!
以上只代表个人观点!!!如有兴趣一起加QQ群:(186841119 ),参与谈论和学习交流
你可能感兴趣的:(抓取网站数据不再是难事了,Fizzler(So Easy)全能搞定)
情绪觉察日记第37天
露露_e800
今天是家庭关系规划师的第二阶最后一天,慧萍老师帮我做了个案,帮我处理了埋在心底好多年的一份恐惧,并给了我深深的力量!这几天出来学习,爸妈过来婆家帮我带小孩,妈妈出于爱帮我收拾东西,并跟我先生和婆婆产生矛盾,妈妈觉得他们没有照顾好我…。今晚回家见到妈妈,我很欣赏她并赞扬她,妈妈说今晚要跟我睡我说好,当我们俩躺在床上准备睡觉的时候,我握着妈妈的手对她说:妈妈这几天辛苦你了,你看你多利害把我们的家收拾得
机器学习与深度学习间关系与区别
ℒℴѵℯ心·动ꦿ໊ོ꫞
人工智能 学习 深度学习 python
一、机器学习概述定义机器学习(MachineLearning,ML)是一种通过数据驱动的方法,利用统计学和计算算法来训练模型,使计算机能够从数据中学习并自动进行预测或决策。机器学习通过分析大量数据样本,识别其中的模式和规律,从而对新的数据进行判断。其核心在于通过训练过程,让模型不断优化和提升其预测准确性。主要类型1.监督学习(SupervisedLearning)监督学习是指在训练数据集中包含输入
铭刻于星(四十二)
随风至
69夜晚,绍敏同学做完功课后,看了眼房外,没听到动静才敢从书包的夹层里拿出那个心形纸团。折痕压得很深,都有些旧了,想来是已经写好很久了。绍敏同学慢慢地、轻轻地捏开折叠处,待到全部拆开后,又反复抚平纸张,然后仔细地一字字默看。只是开头的三个字是第一次看到,让她心漏跳了几拍。“亲爱的绍敏:从四年级的时候,我就喜欢你了,但是我一直不敢说,怕影响你学习。六年级的时候听说有人跟你表白,你接受了,我很难过,但
随笔 | 仙一般的灵气
海思沧海
仙岛今天,我看了你全部,似乎已经进入你的世界我不知道,这是否是梦幻,还是你仙一般的灵气吸引了我也许每一个人都要有一份属于自己的追求,这样才能够符合人生的梦想,生活才能够充满着阳光与快乐我不知道,我为什么会这样的感叹,是在感叹自己的人生,还是感叹自己一直没有孜孜不倦的追求只感觉虚度了光阴,每天活在自己的梦中,活在一个不真实的世界是在逃避自己,还是在逃避周围的一切有时候我嘲笑自己,嘲笑自己如此的虚无,
【iOS】MVC设计模式
Magnetic_h
ios mvc 设计模式 objective-c 学习 ui
MVC前言如何设计一个程序的结构,这是一门专门的学问,叫做"架构模式"(architecturalpattern),属于编程的方法论。MVC模式就是架构模式的一种。它是Apple官方推荐的App开发架构,也是一般开发者最先遇到、最经典的架构。MVC各层controller层Controller/ViewController/VC(控制器)负责协调Model和View,处理大部分逻辑它将数据从Mod
一百九十四章. 自相矛盾
巨木擎天
唉!就这么一夜,林子感觉就像过了很多天似的,先是回了阳间家里,遇到了那么多不可思议的事情儿。特别是小伙伴们,第二次与自己见面时,僵硬的表情和恐怖的气氛,让自己如坐针毡,打从心眼里难受!还有东子,他现在还好吗?有没有被人欺负?护城河里的小鱼小虾们,还都在吗?水不会真的干枯了吧?那对相亲相爱漂亮的太平鸟儿,还好吧!春天了,到了做窝、下蛋、喂养小鸟宝宝的时候了,希望它们都能够平安啊!虽然没有看见家人,也
微服务下功能权限与数据权限的设计与实现
nbsaas-boot
微服务 java 架构
在微服务架构下,系统的功能权限和数据权限控制显得尤为重要。随着系统规模的扩大和微服务数量的增加,如何保证不同用户和服务之间的访问权限准确、细粒度地控制,成为设计安全策略的关键。本文将讨论如何在微服务体系中设计和实现功能权限与数据权限控制。1.功能权限与数据权限的定义功能权限:指用户或系统角色对特定功能的访问权限。通常是某个用户角色能否执行某个操作,比如查看订单、创建订单、修改用户资料等。数据权限:
学点心理知识,呵护孩子健康
静候花开_7090
昨天听了华中师范大学教育管理学系副教授张玲老师的《哪里才是学生心理健康的最后庇护所,超越教育与技术的思考》的讲座。今天又重新学习了一遍,收获匪浅。张玲博士也注意到了当今社会上的孩子由于心理问题导致的自残、自杀及伤害他人等恶性事件。她向我们普及了一个重要的命题,她说心理健康的一些基本命题,我们与我们通常的一些教育命题是不同的,她还举了几个例子,让我们明白我们原来以为的健康并非心理学上的健康。比如如果
c++ 的iostream 和 c++的stdio的区别和联系
黄卷青灯77
c++ 算法 开发语言 iostream stdio
在C++中,iostream和C语言的stdio.h都是用于处理输入输出的库,但它们在设计、用法和功能上有许多不同。以下是两者的区别和联系:区别1.编程风格iostream(C++风格):C++标准库中的输入输出流类库,支持面向对象的输入输出操作。典型用法是cin(输入)和cout(输出),使用>操作符来处理数据。更加类型安全,支持用户自定义类型的输入输出。#includeintmain(){in
《投行人生》读书笔记
小蘑菇的树洞
《投行人生》----作者詹姆斯-A-朗德摩根斯坦利副主席40年的职业洞见-很短小精悍的篇幅,比较适合初入职场的新人。第一部分成功的职业生涯需要规划1.情商归为适应能力分享与协作同理心适应能力,更多的是自我意识,你有能力识别自己的情并分辨这些情绪如何影响你的思想和行为。2.对于初入职场的人的建议,细节,截止日期和数据很重要截止日期,一种有效的方法是请老板为你所有的任务进行优先级排序。和老板喝咖啡的好
《策划经理回忆录之二》
路基雅虎
话说三年变六年,飘了,飘了……眨眼,2013年5月,老吴回到了他的家乡——油城从新开启他的工作幻想症生涯。很庆幸,这是一家很有追求,同时敢于尝试的,且实力不容低调的新星房企——金源置业(前身泰源置业)更值得庆幸的是第一个盘就是油城十路的标杆之一:金源盛世。2013年5月,到2015年11月,两年的陪伴,迎来了一场大爆发。2000个筹,5万/筹,直接回笼1个亿!!!这……让我开始认真审视这座看似五线
Long类型前后端数据不一致
igotyback
前端
响应给前端的数据浏览器控制台中response中看到的Long类型的数据是正常的到前端数据不一致前后端数据类型不匹配是一个常见问题,尤其是当后端使用Java的Long类型(64位)与前端JavaScript的Number类型(最大安全整数为2^53-1,即16位)进行数据交互时,很容易出现精度丢失的问题。这是因为JavaScript中的Number类型无法安全地表示超过16位的整数。为了解决这个问
如何在 Fork 的 GitHub 项目中保留自己的修改并同步上游更新?github_fork_update
iBaoxing
github
如何在Fork的GitHub项目中保留自己的修改并同步上游更新?在GitHub上Fork了一个项目后,你可能会对项目进行一些修改,同时原作者也在不断更新。如果想要在保留自己修改的基础上,同步原作者的最新更新,很多人会不知所措。本文将详细讲解如何在不丢失自己改动的情况下,将上游仓库的更新合并到自己的仓库中。问题描述假设你在GitHub上Fork了一个项目,并基于该项目做了一些修改,随后你发现原作者对
店群合一模式下的社区团购新发展——结合链动 2+1 模式、AI 智能名片与 S2B2C 商城小程序源码
说私域
人工智能 小程序
摘要:本文探讨了店群合一的社区团购平台在当今商业环境中的重要性和优势。通过分析店群合一模式如何将互联网社群与线下终端紧密结合,阐述了链动2+1模式、AI智能名片和S2B2C商城小程序源码在这一模式中的应用价值。这些创新元素的结合为社区团购带来了新的机遇,提升了用户信任感、拓展了营销渠道,并实现了线上线下的完美融合。一、引言随着互联网技术的不断发展,社区团购作为一种新兴的商业模式,在满足消费者日常需
我校举行新老教师师徒结对仪式暨名师专业工作室工作交流活动
李蕾1229
为促进我校教师专业发展,发挥骨干教师的引领带头作用,11月6日下午,我校举行新老教师师徒结对仪式暨名师专业工作室工作交流活动。图片发自App会议由教师发展处李蕾主任主持,首先,由范校长宣读新老教师结对名单及双方承担职责。随后,两位新调入教师陈玉萍、莫正杰分别和他们的师傅鲍元美、刘召彬老师签订了师徒结对协议书。图片发自App图片发自App师徒拥抱、握手。有了师傅就有了目标有了方向,相信两位新教师在师
html 中如何使用 uniapp 的部分方法
某公司摸鱼前端
html uni-app 前端
示例代码:Documentconsole.log(window);效果展示:好了,现在就可以uni.使用相关的方法了
高级编程--XML+socket练习题
masa010
java 开发语言
1.北京华北2114.8万人上海华东2,500万人广州华南1292.68万人成都华西1417万人(1)使用dom4j将信息存入xml中(2)读取信息,并打印控制台(3)添加一个city节点与子节点(4)使用socketTCP协议编写服务端与客户端,客户端输入城市ID,服务器响应相应城市信息(5)使用socketTCP协议编写服务端与客户端,客户端要求用户输入city对象,服务端接收并使用dom4j
第一场雪
岁月静好_nx
早晨起来,外面白茫茫的一片,总算是下雪了,这还是今年第一场雪呢!走在路上,踩着雪“咯吱咯吱”的,空气很湿润。树上、草坪上、屋顶上都落了白白的一层,天上还零星漂着几点雪。慢慢走在路上,呼吸着清新的空气,感受着冬天的美好,心情也好多了。
我的烦恼
余建梅
我的烦恼。女儿问我:“你给学生布置什么作文题目?”“《我的烦恼》。”“他们都这么大了,你觉得他们还有烦恼吗?”“有啊!每个人都会有自己烦恼。”“我不相信,大人是没有烦恼的,如果说一定有的话,你的烦恼和我写作业有关,而且是小烦恼。不像我,天天被你说,有这样的妈妈,烦恼是没完没了。”女儿愤愤不平。每个人都会有自己的烦恼,处在上有老下有小的年纪,烦恼多的数不完。想干好工作带好孩子,想孝顺父母又想经营好自
《大清方方案》| 第二话
谁佐清欢
和珅究竟说了些什么?竟能令堂堂九五之尊龙颜失色!此处暂且按下不表;单说这位乾隆皇帝,果真不愧是康熙从小带过的,一旦决定了要做的事,便杀伐决断毫不含糊。他当即亲自拟旨,着令和珅为钦差大臣,全权负责处理方方事件,并钦赐尚方宝剑,遇急则三品以下官员可先斩后奏。和珅身负皇上重托,岂敢有半点怠慢,当夜即率领相关人等,马不停蹄杀奔江汉。这一路上,和珅的几位幕僚一直在商讨方方事件的处置方案。有位年轻幕僚建议快刀
Python数据分析与可视化实战指南
William数据分析
python python 数据
在数据驱动的时代,Python因其简洁的语法、强大的库生态系统以及活跃的社区,成为了数据分析与可视化的首选语言。本文将通过一个详细的案例,带领大家学习如何使用Python进行数据分析,并通过可视化来直观呈现分析结果。一、环境准备1.1安装必要库在开始数据分析和可视化之前,我们需要安装一些常用的库。主要包括pandas、numpy、matplotlib和seaborn等。这些库分别用于数据处理、数学
WPF中的ComboBox控件几种数据绑定的方式
互联网打工人no1
wpf c#
一、用字典给ItemsSource赋值(此绑定用的地方很多,建议熟练掌握)在XMAL中:在CS文件中privatevoidBindData(){DictionarydicItem=newDictionary();dicItem.add(1,"北京");dicItem.add(2,"上海");dicItem.add(3,"广州");cmb_list.ItemsSource=dicItem;cmb_l
Pyecharts数据可视化大屏:打造沉浸式数据分析体验
我的运维人生
信息可视化 数据分析 数据挖掘 运维开发 技术共享
Pyecharts数据可视化大屏:打造沉浸式数据分析体验在当今这个数据驱动的时代,如何将海量数据以直观、生动的方式展现出来,成为了数据分析师和企业决策者关注的焦点。Pyecharts,作为一款基于Python的开源数据可视化库,凭借其丰富的图表类型、灵活的配置选项以及高度的定制化能力,成为了构建数据可视化大屏的理想选择。本文将深入探讨如何利用Pyecharts打造数据可视化大屏,并通过实际代码案例
情殇——(5)压抑的小木匠放纵了自己。
石疯聊情感故事
木讷的小木匠,其实只是不苟言笑。其实内心深处也是挣扎着,由于性格内敛,不喜形于色,给人的感觉非常的木讷。其实小木匠情商智商都不低。他为人扎实,非常的务实。他的爱是既深沉又宽容。可是是一个男人,都会对妻子出轨的事儿,不会忘怀!只是压抑在心底,为了某种考量或许是真爱。小木匠对于丽影和别人私奔又重回家庭,表面上并没有,天翻地覆,暴风骤雨,其内心深处也是经历了,痛苦的挣扎。。。再一次酒后,他和一个离家多年
Python教程:一文了解使用Python处理XPath
旦莫
Python进阶 python 开发语言
目录1.环境准备1.1安装lxml1.2验证安装2.XPath基础2.1什么是XPath?2.2XPath语法2.3示例XML文档3.使用lxml解析XML3.1解析XML文档3.2查看解析结果4.XPath查询4.1基本路径查询4.2使用属性查询4.3查询多个节点5.XPath的高级用法5.1使用逻辑运算符5.2使用函数6.实战案例6.1从网页抓取数据6.1.1安装Requests库6.1.2代
Google earth studio 简介
陟彼高冈yu
旅游
GoogleEarthStudio是一个基于Web的动画工具,专为创作使用GoogleEarth数据的动画和视频而设计。它利用了GoogleEarth强大的三维地图和卫星影像数据库,使用户能够轻松地创建逼真的地球动画、航拍视频和动态地图可视化。网址为https://www.google.com/earth/studio/。GoogleEarthStudio是一个基于Web的动画工具,专为创作使用G
python os.environ_python os.environ 读取和设置环境变量
weixin_39605414
python os.environ
>>>importos>>>os.environ.keys()['LC_NUMERIC','GOPATH','GOROOT','GOBIN','LESSOPEN','SSH_CLIENT','LOGNAME','USER','HOME','LC_PAPER','PATH','DISPLAY','LANG','TERM','SHELL','J2REDIR','LC_MONETARY','QT_QPA
相信相信的力量
孙丽_cdb3
孙丽中级十期坚持分享第345天有一个特别有哲理的故事:有一只老鹰下了蛋,这个蛋,不知怎的就滚到了鸡窝里去了,鸡也下了一窝蛋,然后鸡妈妈把这些蛋全都浮出来了,孵出来之后等小鸡长大一点了,就觉得鹰蛋孵出来的那只小鹰怪模怪样,这些小鸡都嘲笑它,真难看,真笨,丑死了,那只小鹰觉得自己真是谁也不像,真是不好看,后来鸡妈妈也不喜欢他,我怎么生出你这样的孩子来了?真烦人,后来这群小鸡和小鹰一起生活,有一天,老鹰
今天我破防了
sin信仰
今天本来是大年初一,新年的第一天,应该是高高兴兴的一天,但是我怎么也高兴不起来。具体原因很简单,原本计划年后去县城找了一份会计的工作,被公公婆婆否定了,我心里立马就不舒服了,但是当时刚好肚子疼,我去了厕所,等我上完厕所,公公由于喝了酒还在那里和婆婆唠叨个没完。然后我就在心情极度压抑的情况下把午饭吃完的碗筷和锅给刷了。边刷碗筷和锅,边在那里难受,感觉自己在这个家里真的是过的憋屈死了,公婆不让我去上班
谁家酒器最绝唱,藏在酒厂人未知?景阳冈酒厂先秦藏品大揭秘
李虓酒评论
文/王赛时中国的酒器酒具历史久远,举世闻名。从北京的故宫博物院、中国国家博物馆,到世界各国的大型博物馆,都以能够收藏中国古代酒具而夸耀。但很少有人知道,在山东阳谷景阳冈酒厂,默默地收藏了两千件中国酒器。这些酒器,就封藏在景阳冈的酒道馆里。其中有一些青铜酒器,一睡就是三、四千年,堪称无声国宝,堪作无字史书!今天,我将引领诸位首先窥视一下景阳冈酒道馆的9件先秦藏品,你自己来说震撼不震撼。提示:这只是景
枚举的构造函数中抛出异常会怎样
bylijinnan
java enum 单例
首先从使用enum实现单例说起。
为什么要用enum来实现单例?
这篇文章(
http://javarevisited.blogspot.sg/2012/07/why-enum-singleton-are-better-in-java.html)阐述了三个理由:
1.enum单例简单、容易,只需几行代码:
public enum Singleton {
INSTANCE;
CMake 教程
aigo
C++
转自:http://xiang.lf.blog.163.com/blog/static/127733322201481114456136/
CMake是一个跨平台的程序构建工具,比如起自己编写Makefile方便很多。
介绍:http://baike.baidu.com/view/1126160.htm
本文件不介绍CMake的基本语法,下面是篇不错的入门教程:
http:
cvc-complex-type.2.3: Element 'beans' cannot have character
Cb123456
spring Webgis
cvc-complex-type.2.3: Element 'beans' cannot have character
Line 33 in XML document from ServletContext resource [/WEB-INF/backend-servlet.xml] is i
jquery实例:随页面滚动条滚动而自动加载内容
120153216
jquery
<script language="javascript">
$(function (){
var i = 4;$(window).bind("scroll", function (event){
//滚动条到网页头部的 高度,兼容ie,ff,chrome
var top = document.documentElement.s
将数据库中的数据转换成dbs文件
何必如此
sql dbs
旗正规则引擎通过数据库配置器(DataBuilder)来管理数据库,无论是Oracle,还是其他主流的数据都支持,操作方式是一样的。旗正规则引擎的数据库配置器是用于编辑数据库结构信息以及管理数据库表数据,并且可以执行SQL 语句,主要功能如下。
1)数据库生成表结构信息:
主要生成数据库配置文件(.conf文
在IBATIS中配置SQL语句的IN方式
357029540
ibatis
在使用IBATIS进行SQL语句配置查询时,我们一定会遇到通过IN查询的地方,在使用IN查询时我们可以有两种方式进行配置参数:String和List。具体使用方式如下:
1.String:定义一个String的参数userIds,把这个参数传入IBATIS的sql配置文件,sql语句就可以这样写:
<select id="getForms" param
Spring3 MVC 笔记(一)
7454103
spring mvc bean REST JSF
自从 MVC 这个概念提出来之后 struts1.X struts2.X jsf 。。。。。
这个view 层的技术一个接一个! 都用过!不敢说哪个绝对的强悍!
要看业务,和整体的设计!
最近公司要求开发个新系统!
Timer与Spring Quartz 定时执行程序
darkranger
spring bean 工作 quartz
有时候需要定时触发某一项任务。其实在jdk1.3,java sdk就通过java.util.Timer提供相应的功能。一个简单的例子说明如何使用,很简单: 1、第一步,我们需要建立一项任务,我们的任务需要继承java.util.TimerTask package com.test; import java.text.SimpleDateFormat; import java.util.Date;
大端小端转换,le32_to_cpu 和cpu_to_le32
aijuans
C语言相关
大端小端转换,le32_to_cpu 和cpu_to_le32 字节序
http://oss.org.cn/kernel-book/ldd3/ch11s04.html
小心不要假设字节序. PC 存储多字节值是低字节为先(小端为先, 因此是小端), 一些高级的平台以另一种方式(大端)
Nginx负载均衡配置实例详解
avords
[导读] 负载均衡是我们大流量网站要做的一个东西,下面我来给大家介绍在Nginx服务器上进行负载均衡配置方法,希望对有需要的同学有所帮助哦。负载均衡先来简单了解一下什么是负载均衡,单从字面上的意思来理解就可以解 负载均衡是我们大流量网站要做的一个东西,下面我来给大家介绍在Nginx服务器上进行负载均衡配置方法,希望对有需要的同学有所帮助哦。
负载均衡
先来简单了解一下什么是负载均衡
乱说的
houxinyou
框架 敏捷开发 软件测试
从很久以前,大家就研究框架,开发方法,软件工程,好多!反正我是搞不明白!
这两天看好多人研究敏捷模型,瀑布模型!也没太搞明白.
不过感觉和程序开发语言差不多,
瀑布就是顺序,敏捷就是循环.
瀑布就是需求、分析、设计、编码、测试一步一步走下来。而敏捷就是按摸块或者说迭代做个循环,第个循环中也一样是需求、分析、设计、编码、测试一步一步走下来。
也可以把软件开发理
欣赏的价值——一个小故事
bijian1013
有效辅导 欣赏 欣赏的价值
第一次参加家长会,幼儿园的老师说:"您的儿子有多动症,在板凳上连三分钟都坐不了,你最好带他去医院看一看。" 回家的路上,儿子问她老师都说了些什么,她鼻子一酸,差点流下泪来。因为全班30位小朋友,惟有他表现最差;惟有对他,老师表现出不屑,然而她还在告诉她的儿子:"老师表扬你了,说宝宝原来在板凳上坐不了一分钟,现在能坐三分钟。其他妈妈都非常羡慕妈妈,因为全班只有宝宝
包冲突问题的解决方法
bingyingao
eclipse maven exclusions 包冲突
包冲突是开发过程中很常见的问题:
其表现有:
1.明明在eclipse中能够索引到某个类,运行时却报出找不到类。
2.明明在eclipse中能够索引到某个类的方法,运行时却报出找不到方法。
3.类及方法都有,以正确编译成了.class文件,在本机跑的好好的,发到测试或者正式环境就
抛如下异常:
java.lang.NoClassDefFoundError: Could not in
【Spark七十五】Spark Streaming整合Flume-NG三之接入log4j
bit1129
Stream
先来一段废话:
实际工作中,业务系统的日志基本上是使用Log4j写入到日志文件中的,问题的关键之处在于业务日志的格式混乱,这给对日志文件中的日志进行统计分析带来了极大的困难,或者说,基本上无法进行分析,每个人写日志的习惯不同,导致日志行的格式五花八门,最后只能通过grep来查找特定的关键词缩小范围,但是在集群环境下,每个机器去grep一遍,分析一遍,这个效率如何可想之二,大好光阴都浪费在这上面了
sudoku solver in Haskell
bookjovi
sudoku haskell
这几天没太多的事做,想着用函数式语言来写点实用的程序,像fib和prime之类的就不想提了(就一行代码的事),写什么程序呢?在网上闲逛时发现sudoku游戏,sudoku十几年前就知道了,学生生涯时也想过用C/Java来实现个智能求解,但到最后往往没写成,主要是用C/Java写的话会很麻烦。
现在写程序,本人总是有一种思维惯性,总是想把程序写的更紧凑,更精致,代码行数最少,所以现
java apache ftpClient
bro_feng
java
最近使用apache的ftpclient插件实现ftp下载,遇见几个问题,做如下总结。
1. 上传阻塞,一连串的上传,其中一个就阻塞了,或是用storeFile上传时返回false。查了点资料,说是FTP有主动模式和被动模式。将传出模式修改为被动模式ftp.enterLocalPassiveMode();然后就好了。
看了网上相关介绍,对主动模式和被动模式区别还是比较的模糊,不太了解被动模
读《研磨设计模式》-代码笔记-工厂方法模式
bylijinnan
java 设计模式
声明: 本文只为方便我个人查阅和理解,详细的分析以及源代码请移步 原作者的博客http://chjavach.iteye.com/
package design.pattern;
/*
* 工厂方法模式:使一个类的实例化延迟到子类
* 某次,我在工作不知不觉中就用到了工厂方法模式(称为模板方法模式更恰当。2012-10-29):
* 有很多不同的产品,它
面试记录语
chenyu19891124
招聘
或许真的在一个平台上成长成什么样,都必须靠自己去努力。有了好的平台让自己展示,就该好好努力。今天是自己单独一次去面试别人,感觉有点小紧张,说话有点打结。在面试完后写面试情况表,下笔真的好难,尤其是要对面试人的情况说明真的好难。
今天面试的是自己同事的同事,现在的这个同事要离职了,介绍了我现在这位同事以前的同事来面试。今天这位求职者面试的是配置管理,期初看了简历觉得应该很适合做配置管理,但是今天面
Fire Workflow 1.0正式版终于发布了
comsci
工作 workflow Google
Fire Workflow 是国内另外一款开源工作流,作者是著名的非也同志,哈哈....
官方网站是 http://www.fireflow.org
经过大家努力,Fire Workflow 1.0正式版终于发布了
正式版主要变化:
1、增加IWorkItem.jumpToEx(...)方法,取消了当前环节和目标环节必须在同一条执行线的限制,使得自由流更加自由
2、增加IT
Python向脚本传参
daizj
python 脚本 传参
如果想对python脚本传参数,python中对应的argc, argv(c语言的命令行参数)是什么呢?
需要模块:sys
参数个数:len(sys.argv)
脚本名: sys.argv[0]
参数1: sys.argv[1]
参数2: sys.argv[
管理用户分组的命令gpasswd
dongwei_6688
passwd
NAME: gpasswd - administer the /etc/group file
SYNOPSIS:
gpasswd group
gpasswd -a user group
gpasswd -d user group
gpasswd -R group
gpasswd -r group
gpasswd [-A user,...] [-M user,...] g
郝斌老师数据结构课程笔记
dcj3sjt126com
数据结构与算法
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
yii2 cgridview加上选择框进行操作
dcj3sjt126com
GridView
页面代码
<?=Html::beginForm(['controller/bulk'],'post');?>
<?=Html::dropDownList('action','',[''=>'Mark selected as: ','c'=>'Confirmed','nc'=>'No Confirmed'],['class'=>'dropdown',])
linux mysql
fypop
linux
enquiry mysql version in centos linux
yum list installed | grep mysql
yum -y remove mysql-libs.x86_64
enquiry mysql version in yum repositoryyum list | grep mysql oryum -y list mysql*
install mysq
Scramble String
hcx2013
String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.
Below is one possible representation of s1 = "great":
跟我学Shiro目录贴
jinnianshilongnian
跟我学shiro
历经三个月左右时间,《跟我学Shiro》系列教程已经完结,暂时没有需要补充的内容,因此生成PDF版供大家下载。最近项目比较紧,没有时间解答一些疑问,暂时无法回复一些问题,很抱歉,不过可以加群(334194438/348194195)一起讨论问题。
----广告-----------------------------------------------------
nginx日志切割并使用flume-ng收集日志
liyonghui160com
nginx的日志文件没有rotate功能。如果你不处理,日志文件将变得越来越大,还好我们可以写一个nginx日志切割脚本来自动切割日志文件。第一步就是重命名日志文件,不用担心重命名后nginx找不到日志文件而丢失日志。在你未重新打开原名字的日志文件前,nginx还是会向你重命名的文件写日志,linux是靠文件描述符而不是文件名定位文件。第二步向nginx主
Oracle死锁解决方法
pda158
oracle
select p.spid,c.object_name,b.session_id,b.oracle_username,b.os_user_name from v$process p,v$session a, v$locked_object b,all_objects c where p.addr=a.paddr and a.process=b.process and c.object_id=b.
java之List排序
shiguanghui
list排序
在Java Collection Framework中定义的List实现有Vector,ArrayList和LinkedList。这些集合提供了对对象组的索引访问。他们提供了元素的添加与删除支持。然而,它们并没有内置的元素排序支持。 你能够使用java.util.Collections类中的sort()方法对List元素进行排序。你既可以给方法传递
servlet单例多线程
utopialxw
单例 多线程 servlet
转自http://www.cnblogs.com/yjhrem/articles/3160864.html
和 http://blog.chinaunix.net/uid-7374279-id-3687149.html
Servlet 单例多线程
Servlet如何处理多个请求访问?Servlet容器默认是采用单实例多线程的方式处理多个请求的:1.当web服务器启动的