C# chart pie饼状图 右上角的LegendText的个数怎么控制啊

图1是要求的样子
图2是我做的样子
本来只要2个颜色一个正常显示 一个超长显示
但是他自动给你出来7个 而且text只能设置一种
图片说明
图片说明

2个回答

你可以不显示默认的Legend,用自己的Label代替

你有几个扇形,就有几个Legends,你一厢情愿把不同的扇形设置成相同的颜色没用,它不认多少颜色,而是认多少数据项(扇形)。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
chart 绘制的pie 饼状图,如何自定义每个部分的颜色?
如题.绘制出来的饼状图是很好,但是我想自定义每个部分的颜色,应该如何做呢?
c#操作PowerPoint添加chart
最近在做一个用c#直接操作ppt的程序,通过c#处理数据后直接生成一个ppt。但是在添加图表的时候只能将图表本身加进去,数据需要人工输入图表对应的excel图表才能正确显示数据,不知道怎么才能直接就将数据加入到图表对应的excel中,这样就不在需要人工输入了 下面是添加图标的代码: private void chartButton_Click(object sender, EventArgs e) { string path = pptPathTextBox.Text; OpenPPT(path); //Add a new slide int count = presentation.Slides.Count; presentation.Slides.Add(count + 1, PPT.PpSlideLayout.ppLayoutBlank); //Add a pie chart slide = presentation.Slides[count + 1]; Graph.Chart aChart = (Graph.Chart)slide.Shapes.AddOLEObject(150, 150, 480, 320,"MSGraph.Chart.8", "", MsoTriState.msoFalse, "", 0, "",MsoTriState.msoFalse).OLEFormat.Object; aChart.ChartType = Graph.XlChartType.xl3DPie; aChart.Legend.Position = Graph.XlLegendPosition.xlLegendPositionBottom; aChart.HasTitle = true; aChart.ChartTitle.Text = "It is a pie chart"; }
#Leaflet#用Chart.js在JavaScript生成的canvas里面绘制饼图 获取ElementID后出错
一个基于Leaflet开发的小小小项目 问题大概只这样的: 首先是我用L.control()生成一个控件(info),通过.update()方法对控件进行更新。在.update()中我创建了一个新的canvas元素,之后通过document.getElementById()获取该元素,并使用Chart.js库创建一个饼图。在调用Chart.js库的时候就报错了(TypeError: item is null)。 ``` 相关资源: <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.js"></script> <style> #map{ height: 70% } .info { padding: 16px 10px; font: 14px/16px Arial, Helvetica, sans-serif; background: white; background: rgba(255,255,255,0.8); box-shadow: 0 0 15px rgba(0,0,0,0.2); border-radius: 5px; } .info h4 { margin: 0 0 5px; color: 'white'; } </style> ``` 报错内容如下: TypeError: item is nullChart.bundle.js:6904:14 acquireContext https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.js:6904 construct https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.js:8423 Chart https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.js:8410 update http://127.0.0.1:5500/static/js/load_tiff.js:85 onAdd http://127.0.0.1:5500/static/js/load_tiff.js:76 addTo http://127.0.0.1:5500/static/js/leaflet/leaflet.js:5 <anonymous> http://127.0.0.1:5500/static/js/load_tiff.js:90 ``` 相关代码如下: var randomScalingFactor = function() { return Math.round(Math.random() * 100); }; var config = { type: 'pie', data: { datasets: [{ data: [ randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), ], backgroundColor: [ "rgba(230, 14, 14, 1)", "rgba(230, 122, 14, 1)", "rgba(230, 230, 14, 1)", "rgba(122, 230, 14, 1)", "rgba(14, 122, 230, 1)", ], label: 'Dataset 1' }], labels: [ 'Red', 'Orange', 'Yellow', 'Green', 'Blue' ] }, options: { responsive: true } }; var info = L.control(); info.onAdd = function(mymap) { this._div = L.DomUtil.create('div', 'info'); this.update(); return this._div; }; info.update = function() { var content = '<h4>Statistic Info</h4>' + '<br />'; content += '<canvas id="myChart" width="10" height="10"></canvas>'; this._div.innerHTML = content; var piechart = new Chart(document.getElementById('myChart'),config) }; info.addTo(mymap); ```
如何用代码使饼形图上数字变为百分数,而图例为何会变成这样(文字图例为正常的)
![图片说明](https://img-ask.csdn.net/upload/201907/23/1563869183_381363.png) ![图片说明](https://img-ask.csdn.net/upload/201907/22/1563805706_642294.png) ``` string dbPath = @"D:\历年高考分数.db"; string sq = @"Data Source=" + dbPath; m = new SQLiteConnection(sq); m.Open(); SQLiteDataAdapter mAdapter = new SQLiteDataAdapter("select Volume1,Volume2 from 饼形图2", m); DataSet ds = new DataSet(); mAdapter.Fill(ds); DataTable dt = ds.Tables[0]; //设置图表的数据 Chart1.DataSource = dt; Chart1.Series[0].ChartType = SeriesChartType.Pie; Chart1.Series[0].XValueMember = "Volume1";//图例数据成员列 Chart1.Series[0].YValueMembers = "Volume2";//饼形图上数据成员列 Chart1.Series[0].IsValueShownAsLabel = true;// Chart1.Series[0].IsXValueIndexed = false; Chart1.Series[0].Label = "#PERCENT"; Chart1.Series[0].LegendText = "#INDEX:#VALX"; Chart1.Series[0].ToolTip = "#VALX"; Chart1.DataBind(); m.Close(); ```
如何用代码使饼形图上数字变为百分数,而图例不受影响,数据和文字都来自sqlite数据库
![图片说明](https://img-ask.csdn.net/upload/201907/18/1563435312_347398.png) ``` string dbPath = @"D:\历年高考分数.db"; string sq = @"Data Source=" + dbPath; m = new SQLiteConnection(sq); m.Open(); SQLiteDataAdapter mAdapter = new SQLiteDataAdapter("select Volume1,Volume2 from 饼形图2", m); DataSet ds = new DataSet(); mAdapter.Fill(ds); DataTable dt = ds.Tables[0]; //设置图表的数据 chart3.DataSource = dt; //chart3.Series.Clear(); chart3.Series[0].ChartType = SeriesChartType.Pie;//设置形状 chart3.Series[0].XValueMember = "Volume1";//图例数据成员列 chart3.Series[0].YValueMembers = "Volume2";//饼形图上数据成员列 chart3.Series[0].IsValueShownAsLabel = true;//显示标签 chart3.DataBind(); chart3.Width = 260; chart3.Height = 260; m.Close(); ``` 下面的几种尝试都不对 一:chart1.ChartAreas[0].AxisX.LabelStyle.Format = "#LEGENDTEXT";//显示当前图例的标签文本 chart1.ChartAreas[0].AxisY.LabelStyle.Format = "#VAL%";//显示当前图例的所占的百分比 二:chart1.Series[0].Label = "#VALY%"; 三:chart1.ChartAreas[0].AxisX.LabelStyle.Format = "#VALX"; chart1.ChartAreas[0].AxisY.LabelStyle.Format = "#VALY%";
EPPlus 怎么实现一张chart图存在两种图表类型
var chart = (worksheet.Drawings.AddChart("PieChart", eChartType.Pie3D) as ExcelPieChart); 通过上面的方法可以设置chart图中图表类型, 但是我要在一张chart图中插入一个折线图,一个柱形图,怎么为另一个图表定义类型
使用 AchartEngine 点击 pie chart 中的一些部分,有时候会出 bug
我使用 AchartEngine 制作一个 pie chart,如下: [Pie Chart 图像][1] 我给所有的颜色部分都添加了onclick事件,但是有时候绿色部分不能点击。 mChartView = ChartFactory.getPieChartView(this, adc.buildCategoryDataset("Project budget", values), renderer); mChartView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint(); if (seriesSelection == null) { Toast .makeText(GeneratedChartDemo.this, "No chart element was clicked", Toast.LENGTH_SHORT) .show(); } else { Toast.makeText( GeneratedChartDemo.this, "Chart element data point index " + seriesSelection.getPointIndex() + " was clicked" + " point value=" + seriesSelection.getValue(), Toast.LENGTH_SHORT).show(); } } }); 哪里出错或者是丢失什么呢? [1]: http://i.imgur.com/Ogqc49O.png
kendo ui 的 pie charts怎么动态获取数据库的内容生成饼图
# kendo ui 的 pie charts怎么动态获取数据库的内容生成饼图,柱状图和折线图,求大神指教。 实在是搞不定那个饼图 T~T
matplotlib词云和饼状图的标注问题
为啥词云的左上角会出现饼状图的标注,怎么去掉词云这部分的标注,还有饼状图柱状图和词云函数的调用顺序也会影响最后绘制出来的图片,这是为什么??? import pymongo import snownlp as sn import matplotlib.pyplot as plt import numpy as np import sys from PyQt5.QtGui import * from PyQt5.QtWidgets import * import jieba from os import path from PIL import Image from wordcloud import WordCloud bg = np.array(Image.open("./data/233.jpg")) d = path.dirname(__file__) stopwords_path = './data/stop_word.txt' text_path = "test.txt" text = open(path.join(d, text_path), encoding='utf-8').read() class filedialogdemo(QWidget): def __init__(self, parent=None): super(filedialogdemo, self).__init__(parent) layout = QHBoxLayout() self.lable1 = QLabel() self.lable1.setPixmap(QPixmap("./data/bar.jpg")) layout.addWidget(self.lable1) self.lable2 = QLabel() self.lable2.setPixmap(QPixmap("./data/pie.jpg")) layout.addWidget(self.lable2) self.lable3 = QLabel() self.lable3.setPixmap(QPixmap("./data/WordCloud.png")) layout.addWidget(self.lable3) self.setLayout(layout) self.setWindowTitle("Result") def sentiment(text): if text == '': return 0.5 else: s = sn.SnowNLP(text) return s.sentiments def Paint_Bar(num1, num2, num3, num4): plt.rcParams['font.sans-serif'] = ['SimHei'] #显示中文 plt.bar(0.125, num1,width=0.1, label='really bad') plt.bar(0.375, num2,width=0.1, label='bad') plt.bar(0.625, num3,width=0.1, label='good') plt.bar(0.875, num4,width=0.1, label='really good') plt.text(0.125, num1 + 0.5, '%d' % num1, ha='center', va='bottom') plt.text(0.375, num2 + 0.5, '%d' % num2, ha='center', va='bottom') plt.text(0.625, num3 + 0.5, '%d' % num3, ha='center', va='bottom') plt.text(0.875, num4 + 0.5, '%d' % num4, ha='center', va='bottom') plt.xlabel(u'x轴') plt.ylabel(u'y轴') ax = plt.gca() ax.spines['right'].set_color('none') ax.spines['top'].set_color('none') plt.xlim(0, 1) plt.xticks([0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1]) plt.title(u'柱形图') plt.legend() plt.savefig('./data/bar.jpg') def Paint_Scatter(list): plt.rcParams['font.sans-serif'] = ['SimHei'] # 显示中文 plt.title(u'散点图') list_len = len(list) for list_num in range(list_len): plt.scatter(list[list_num], list[list_num]) def Paint_Pie(num1, num2, num3, num4): list = [] list.append(num1) list.append(num2) list.append(num3) list.append(num4) s = np.max(list) if s == num1: k = 0 elif s == num2: k = 1 elif s == num3: k = 2 else: k = 3 explode = [0,0,0,0] explode[k] = 0.1 labels = 'really bad', 'bad', 'good', 'really good' plt.axes(aspect=1) #椭圆变标准圆 plt.pie(x=list, explode=explode, labels=labels, autopct='%3.1f %%', shadow=True, labeldistance=1.1, startangle=90, pctdistance=0.6) plt.axis('equal') plt.savefig('./data/pie.jpg') def JiebaClearText(text): MywordList = [] seg_list = jieba.cut(text, cut_all=False) listStr = '/'.join(seg_list) f_stop = open(stopwords_path, encoding='utf-8') try: f_stop_text = f_stop.read() finally: f_stop.close() f_stop_seg_list = f_stop_text.split("\n") for myword in listStr.split('/'): if not(myword.split()) in f_stop_seg_list and len(myword.strip()) > 1: MywordList.append(myword) return ' '.join(MywordList) def Paint_cloud(): text1 = JiebaClearText(text) wc = WordCloud(background_color="white", max_words=150, mask=bg, # 设置图片的背景 max_font_size=60, random_state=42, font_path='C:/Windows/Fonts/simkai.ttf' # 中文处理,用系统自带的字体 ).generate(text1) plt.imshow(wc, interpolation="bilinear") plt.axis("off") plt.savefig('./data/WordCloud.png') def run(): num1 = 0 num2 = 0 num3 = 0 num4 = 0 list0 = [] mongo_uri = 'mongodb://localhost:27017/' client = pymongo.MongoClient(mongo_uri) db = client.weibo collection = db.weibo data = collection.find() data = list(data) list_len = int(len(data)) f = open('test.txt', 'w', encoding='utf-8') for num in range(list_len): dict = data[num] text = dict['content'] f.write(text) if text != ':' and text != 0: text_num = sentiment(text) list0.append(text_num) if text_num < 0.25: num1 += 1 elif text_num < 0.5: num2 += 1 elif text_num <0.75: num3 += 1 else: num4 += 1 f.close() Paint_Bar(num1, num2, num3, num4) #柱形图 Paint_Pie(num1, num2, num3, num4) #饼状图 Paint_cloud() #词云 app = QApplication(sys.argv) ex = filedialogdemo() ex.show() sys.exit(app.exec_()) if __name__ == '__main__': run() ![图片说明](https://img-ask.csdn.net/upload/201904/24/1556093276_144225.png)
jquery.easy-pie-chart.js插件环形进度条
我写环形进度条使用的jquery.easy-pie-chart.js这个插件 可以有方法让进度条是逆时针转吗。
matplotlib画pie饼图的时候,有几个块的label说明是重叠起来的
matplotlib画pie饼图的时候,有几个块的label说明是重叠起来的,什么都看不清。大家有什么 好的解决方案吗? ![图片说明](https://img-ask.csdn.net/upload/201802/08/1518085082_20810.jpg)
无人能解。。phpexcel生成饼状图,在Windows下正常在Linux下乱码!
# 生成图片导出时,在Windows下整成显示,在Linux上导出的文件里只有乱码 # 但如果只生成表格,都可以正常显示,这个是代码: include "PHPExcel.php"; include "PHPExcel/Writer/Excel5.php"; //用于输出.xls的 //创建新的对象 $objPHPExcel = new PHPExcel(); $filename=$groname."_".$sclock_time."_".$eclock_time;//名字 系统名_开始时间_结束时间 //保存excel-2007格局 $objWriter = new PHPExcel_Writer_Excel5($objPHPExcel); // 非2007格局 $k=0; $objPHPExcel->setActiveSheetIndex($k);//设置当前的sheet第一个0 //设置标签 $sheet=$objPHPExcel->getActiveSheet(); $sheet->getDefaultRowDimension()->setRowHeight(30); $sheet->getDefaultColumnDimension()->setWidth(20); //合并单元格,写值 function stoa($str,$num){ $arr=explode(",", $str); $arrt=array(); $j=0; for($i=0;$i<count($arr);$i++){ if($i!=0&&$i%$num==0){$j++;} $arrt[$j][]=$arr[$i]; } return $arrt; } //合并单元格 $sheet->mergeCells('A1:D1'); $sheet->mergeCells('F1:G1'); $str="A1,系统报警详细,20,A2,主机名称,10,B2,报警描述,10,C2,报警等级,10,D2,报警时间,10,F1,报警频率最高的监控项,20,F2,报警信息描述,10,G2,对应报警次数,10"; $arr=array(); $arr=stoa($str,3); foreach ($arr as $v) { //写入内容 $sheet->setCellValue($v[0],$v[1]); //设置字体 $sheet->getStyle($v[0])->getFont()->setName('Candara'); $sheet->getStyle($v[0])->getFont()->setSize($v[2]); $sheet->getStyle($v[0])->getFont()->setBold(true); $sheet->getStyle($v[0])->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); } //系统报警详细 表1 $j=1; foreach ($arrnew as $value) { for($i=1;$i<count($value)+1;$i++){ if($i==1){ $sheet->setCellValue('A'.($j+2),$value[$i-1]); }elseif($i==2){ $sheet->setCellValue('B'.($j+2),$value[$i-1]); }elseif($i==3){ $sheet->setCellValue('C'.($j+2),$value[$i-1]); }elseif($i==4){ $sheet->setCellValue('D'.($j+2),$value[$i-1]); } } $j++; } //报警频率最高的监控项 (前5条)表2 $shownum=5;//显示5条 $k=3;//数据显示F3 G3 $tnum=$shownum+$k; $u=0; //真实个数 foreach($arrbjs as $v){ if(isset($v['name'])&&isset($v['num'])&&$k<$tnum){ $sheet->setCellValue("F".$k, $v['name']); $sheet->setCellValue("G".$k, $v['num']); $u++; $k++; } } $sheet->setCellValue("F".$k, '其他'); $sheet->setCellValue("G".$k, count($arrbjs)-$u); //tu $dataseriesLabels1 = array( new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$F$1', NULL, 1), // 标题 ); $xAxisTickValues1 = array( new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$F$3:$F$'.$k, NULL, $u), // 数据名 ); $dataSeriesValues1 = array( new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$G$3:$G$'.$k, NULL, $u), // 数据 ); // Build the dataseries $series1 = new PHPExcel_Chart_DataSeries( PHPExcel_Chart_DataSeries::TYPE_PIECHART, // plotType PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping //饼图 range(0, count($dataSeriesValues1)-1), // plotOrder 范围 $dataseriesLabels1, // plotLabel 标题 $xAxisTickValues1, // plotCategory 数据名 $dataSeriesValues1 // plotValues 数据 ); // 布局 $layout1 = new PHPExcel_Chart_Layout(); $layout1->setShowVal(TRUE); $layout1->setShowPercent(TRUE); // 设置图表的区域 $plotarea1 = new PHPExcel_Chart_PlotArea($layout1, array($series1)); // 设置图表的图例 $legend1 = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false); $title1 = new PHPExcel_Chart_Title('报警频率最高的监控项'); // 创建chart $chart3 = new PHPExcel_Chart( 'chart3', // name $title1, // title $legend1, // legend $plotarea1, // plotArea true, // plotVisibleOnly 0, // displayBlanksAs NULL, // xAxisLabel NULL // yAxisLabel - Pie charts don't have a Y-Axis ); // 图出现位置 $k+=2; $chart3->setTopLeftPosition('F'.$k); //左上角 $k+=18; $chart3->setBottomRightPosition('H'.$k);//右下角 // 准备输出 $sheet->addChart($chart3); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->setIncludeCharts(TRUE); // end tu// //输出信息 header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename='.$filename); header('Cache-Control: max-age=0'); $objWriter->save("php://output");
【C#】菜鸟一枚,有关汉字转拼音的编程问题,谢!
下面粘贴的是书上的源代码,有以下几个问题: 1.asc=M1*256+M2-65536 这个式子是什么含义? 2.为什么计算机内有自己的编码系统,还要自己去定义拼音编码数组和相对应的拼音数组呢? 3.这个编程的思路是怎样的呢? 菜鸟一枚,特别晕菜,希望给予指点。 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Text.RegularExpressions; namespace ChineseToABC { class Program { static void Main(string[] args) { while (true) { Console.WriteLine("请输入要转换的内容:"); string str = Console.ReadLine(); Regex reg = new Regex("^[\u4e00-\u9fa5]$");//验证输入是否为汉字 byte[] arr = new byte[2];//定义字节数组 string pystr = "";//定义字符串变量并添加引用 char[] mChar = str.ToCharArray();//获取汉字对应的字符数组 Console.WriteLine("转换后的拼音:"+GetStr(mChar, pystr, reg, arr)+"\n");//返回获取到的汉字拼音 } } //定义拼音区编码数组 private static int[] getValue = new int[] { -20319,-20317,-20304,-20295,-20292,-20283,-20265,-20257,-20242,-20230,-20051,-20036, -20032,-20026,-20002,-19990,-19986,-19982,-19976,-19805,-19784,-19775,-19774,-19763, -19756,-19751,-19746,-19741,-19739,-19728,-19725,-19715,-19540,-19531,-19525,-19515, -19500,-19484,-19479,-19467,-19289,-19288,-19281,-19275,-19270,-19263,-19261,-19249, -19243,-19242,-19238,-19235,-19227,-19224,-19218,-19212,-19038,-19023,-19018,-19006, -19003,-18996,-18977,-18961,-18952,-18783,-18774,-18773,-18763,-18756,-18741,-18735, -18731,-18722,-18710,-18697,-18696,-18526,-18518,-18501,-18490,-18478,-18463,-18448, -18447,-18446,-18239,-18237,-18231,-18220,-18211,-18201,-18184,-18183, -18181,-18012, -17997,-17988,-17970,-17964,-17961,-17950,-17947,-17931,-17928,-17922,-17759,-17752, -17733,-17730,-17721,-17703,-17701,-17697,-17692,-17683,-17676,-17496,-17487,-17482, -17468,-17454,-17433,-17427,-17417,-17202,-17185,-16983,-16970,-16942,-16915,-16733, -16708,-16706,-16689,-16664,-16657,-16647,-16474,-16470,-16465,-16459,-16452,-16448, -16433,-16429,-16427,-16423,-16419,-16412,-16407,-16403,-16401,-16393,-16220,-16216, -16212,-16205,-16202,-16187,-16180,-16171,-16169,-16158,-16155,-15959,-15958,-15944, -15933,-15920,-15915,-15903,-15889,-15878,-15707,-15701,-15681,-15667,-15661,-15659, -15652,-15640,-15631,-15625,-15454,-15448,-15436,-15435,-15419,-15416,-15408,-15394, -15385,-15377,-15375,-15369,-15363,-15362,-15183,-15180,-15165,-15158,-15153,-15150, -15149,-15144,-15143,-15141,-15140,-15139,-15128,-15121,-15119,-15117,-15110,-15109, -14941,-14937,-14933,-14930,-14929,-14928,-14926,-14922,-14921,-14914,-14908,-14902, -14894,-14889,-14882,-14873,-14871,-14857,-14678,-14674,-14670,-14668,-14663,-14654, -14645,-14630,-14594,-14429,-14407,-14399,-14384,-14379,-14368,-14355,-14353,-14345, -14170,-14159,-14151,-14149,-14145,-14140,-14137,-14135,-14125,-14123,-14122,-14112, -14109,-14099,-14097,-14094,-14092,-14090,-14087,-14083,-13917,-13914,-13910,-13907, -13906,-13905,-13896,-13894,-13878,-13870,-13859,-13847,-13831,-13658,-13611,-13601, -13406,-13404,-13400,-13398,-13395,-13391,-13387,-13383,-13367,-13359,-13356,-13343, -13340,-13329,-13326,-13318,-13147,-13138,-13120,-13107,-13096,-13095,-13091,-13076, -13068,-13063,-13060,-12888,-12875,-12871,-12860,-12858,-12852,-12849,-12838,-12831, -12829,-12812,-12802,-12607,-12597,-12594,-12585,-12556,-12359,-12346,-12320,-12300, -12120,-12099,-12089,-12074,-12067,-12058,-12039,-11867,-11861,-11847,-11831,-11798, -11781,-11604,-11589,-11536,-11358,-11340,-11339,-11324,-11303,-11097,-11077,-11067, -11055,-11052,-11045,-11041,-11038,-11024,-11020,-11019,-11018,-11014,-10838,-10832, -10815,-10800,-10790,-10780,-10764,-10587,-10544,-10533,-10519,-10331,-10329,-10328, -10322,-10315,-10309,-10307,-10296,-10281,-10274,-10270,-10262,-10260,-10256,-10254 }; //定义拼音数组 private static string[] getStr = new string[] { "A","Ai","An","Ang","Ao","Ba","Bai","Ban","Bang","Bao","Bei","Ben", "Beng","Bi","Bian","Biao","Bie","Bin","Bing","Bo","Bu","Ba","Cai","Can", "Cang","Cao","Ce","Ceng","Cha","Chai","Chan","Chang","Chao","Che","Chen","Cheng", "Chi","Chong","Chou","Chu","Chuai","Chuan","Chuang","Chui","Chun","Chuo","Ci","Cong", "Cou","Cu","Cuan","Cui","Cun","Cuo","Da","Dai","Dan","Dang","Dao","De", "Deng","Di","Dian","Diao","Die","Ding","Diu","Dong","Dou","Du","Duan","Dui", "Dun","Duo","E","En","Er","Fa","Fan","Fang","Fei","Fen","Feng","Fo", "Fou","Fu","Ga","Gai","Gan","Gang","Gao","Ge","Gei","Gen","Geng","Gong", "Gou","Gu","Gua","Guai","Guan","Guang","Gui","Gun","Guo","Ha","Hai","Han", "Hang","Hao","He","Hei","Hen","Heng","Hong","Hou","Hu","Hua","Huai","Huan", "Huang","Hui","Hun","Huo","Ji","Jia","Jian","Jiang","Jiao","Jie","Jin","Jing", "Jiong","Jiu","Ju","Juan","Jue","Jun","Ka","Kai","Kan","Kang","Kao","Ke", "Ken","Keng","Kong","Kou","Ku","Kua","Kuai","Kuan","Kuang","Kui","Kun","Kuo", "La","Lai","Lan","Lang","Lao","Le","Lei","Leng","Li","Lia","Lian","Liang", "Liao","Lie","Lin","Ling","Liu","Long","Lou","Lu","Lv","Luan","Lue","Lun", "Luo","Ma","Mai","Man","Mang","Mao","Me","Mei","Men","Meng","Mi","Mian", "Miao","Mie","Min","Ming","Miu","Mo","Mou","Mu","Na","Nai","Nan","Nang", "Nao","Ne","Nei","Nen","Neng","Ni","Nian","Niang","Niao","Nie","Nin","Ning", "Niu","Nong","Nu","Nv","Nuan","Nue","Nuo","O","Ou","Pa","Pai","Pan", "Pang","Pao","Pei","Pen","Peng","Pi","Pian","Piao","Pie","Pin","Ping","Po", "Pu","Qi","Qia","Qian","Qiang","Qiao","Qie","Qin","Qing","Qiong","Qiu","Qu", "Quan","Que","Qun","Ran","Rang","Rao","Re","Ren","Reng","Ri","Rong","Rou", "Ru","Ruan","Rui","Run","Ruo","Sa","Sai","San","Sang","Sao","Se","Sen", "Seng","Sha","Shai","Shan","Shang","Shao","She","Shen","Sheng","Shi","Shou","Shu", "Shua","Shuai","Shuan","Shuang","Shui","Shun","Shuo","Si","Song","Sou","Su","Suan", "Sui","Sun","Suo","Ta","Tai","Tan","Tang","Tao","Te","Teng","Ti","Tian", "Tiao","Tie","Ting","Tong","Tou","Tu","Tuan","Tui","Tun","Tuo","Wa","Wai", "Wan","Wang","Wei","Wen","Weng","Wo","Wu","Xi","Xia","Xian","Xiang","Xiao", "Xie","Xin","Xing","Xiong","Xiu","Xu","Xuan","Xue","Xun","Ya","Yan","Yang", "Yao","Ye","Yi","Yin","Ying","Yo","Yong","You","Yu","Yuan","Yue","Yun", "Za", "Zai","Zan","Zang","Zao","Ze","Zei","Zen","Zeng","Zha","Zhai","Zhan", "Zhang","Zhao","Zhe","Zhen","Zheng","Zhi","Zhong","Zhou","Zhu","Zhua","Zhuai","Zhuan", "Zhuang","Zhui","Zhun","Zhuo","Zi","Zong","Zou","Zu","Zuan","Zui","Zun","Zuo" }; private static string GetStr(char[] mChar, string pystr, Regex reg, byte[] arr) { int asc = 0, M1 = 0, M2 = 0; for (int j = 0; j < mChar.Length; j++) { if (reg.IsMatch(mChar[j].ToString()))//如果输入的是汉字 { arr = System.Text.Encoding.Default.GetBytes(mChar[j].ToString()); M1 = (short)(arr[0]); M2 = (short)(arr[1]); **asc = M1 * 256 + M2 - 65536;** if (asc > 0 && asc < 160) { pystr += mChar[j]; } else { switch (asc) { case -9254: pystr += "Zhen"; break; case -8985: pystr += "Qian"; break; case -5463: pystr += "Jia"; break; case -8274: pystr += "Ge"; break; case -5448: pystr += "Ga"; break; case -5447: pystr += "La"; break; case -4649: pystr += "Chen"; break; case -5436: pystr += "Mao"; break; case -5213: pystr += "Mao"; break; case -3597: pystr += "Die"; break; case -5659: pystr += "Tian"; break; default: for (int i = (getValue.Length - 1); i >= 0; i--) { if (getValue[i] <= asc)//判断汉字的拼音区编码是否在指定范围内 { pystr += getStr[i];//如果不超出范围则获取对应的拼音 break; } } break; } } } else//如果不是汉字 { pystr += mChar[j].ToString();//如果不是汉字则返回 } } return pystr; } } }
小白用python编写的爬虫小程序突然失效,是ip被封还是其他问题,求教?
# 编写的python小程序,爬取豆瓣评论,昨天还可以用,今天就失效了,试过很多种解决方法,都没有成功,求教? ## 可能的问题是ip被封或者cookies? 主程序 ``` # -*- coding: utf-8 -*- import ReviewCollection from snownlp import SnowNLP from matplotlib import pyplot as plt #画饼状图 def PlotPie(ratio, labels, colors): plt.figure(figsize=(6, 8)) explode = (0.05,0) patches,l_text,p_text = plt.pie(ratio,explode=explode,labels=labels,colors=colors, labeldistance=1.1,autopct='%3.1f%%',shadow=False, startangle=90,pctdistance=0.6) plt.axis('equal') plt.legend() plt.show() def main(): #初始url url = 'https://movie.douban.com/subject/30176393/' #保存评论文件 outfile = 'review.txt' (reviews, sentiment) = ReviewCollection.CollectReivew(url, 20, outfile) numOfRevs = len(sentiment) print(numOfRevs) #print(sentiment) positive = 0.0 negative = 0.0 accuracy = 0.0 #利用snownlp逐条分析每个评论的情感 for i in range(numOfRevs): # if sentiment[i] == 1: # positive += 1 # else: # negative += 1 print(reviews[i]+str(i)) sent = SnowNLP(reviews[i]) predict = sent.sentiments #print(predict,end=' ') if predict >= 0.5: positive += 1 if sentiment[i] == 1: accuracy += 1 else: negative += 1 if sentiment[i] == 0: accuracy += 1 #计算情感分析的精度 print('情感预测精度为: ' + str(accuracy/numOfRevs)) # print(positive,negative) #绘制饼状图 #定义饼状图的标签 labels = ['Positive Reviews', 'Negetive Reviews'] #每个标签占的百分比 ratio = [positive/numOfRevs, negative/numOfRevs] # print(ratio[0],ratio[1]) colors = ['red','yellowgreen'] PlotPie(ratio, labels, colors) if __name__=="__main__": main() ``` 次程序 ``` #!/usr/bin/python # -*- coding: utf-8 -*- from bs4 import BeautifulSoup import requests import csv import re import time import codecs import random def StartoSentiment(star): ''' 将评分转换为情感标签,简单起见 我们将大于或等于三星的评论当做正面评论 小于三星的评论当做负面评论 ''' score = int(star[-2]) if score >= 3: return 1 else: return 0 def CollectReivew(root, n, outfile): ''' 收集给定电影url的前n条评论 ''' reviews = [] sentiment = [] urlnumber = 0 headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36','Connection': 'close','cookie': 'll="108303"; bid=DOSjemTnbi0; _pk_ses.100001.4cf6=*; ap_v=0,6.0; __utma=30149280.1517093765.1576143949.1576143949.1576143949.1; __utmb=30149280.0.10.1576143949; __utmc=30149280; __utmz=30149280.1576143949.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=223695111.1844590374.1576143949.1576143949.1576143949.1; __utmc=223695111; __utmz=223695111.1576143949.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmt=1; __yadk_uid=iooXpNnGnHUza2r4ru7uRCpa3BXeHG0l; dbcl2="207917948:BFXaC6risAw"; ck=uFvj; _pk_id.100001.4cf6=4c11da64dc6451d3.1576143947.1.1576143971.1576143947.; __utmb=223695111.2.10.1576143949'} proxies = { "http":'http://121.69.46.177:9000',"https": 'https://122.136.212.132:53281'}#121.69.46.177:9000218.27.136.169:8085 122.136.212.132:53281 while urlnumber < n: url = root + 'comments?start=' + str(urlnumber) + '&limit=20&sort=new_score&status=P' print('要收集的电影评论网页为:' + url) # try: html = requests.get(url, headers = headers, proxies = proxies,timeout = 15) # # except Exception as e: # break soup = BeautifulSoup(html.text.encode("utf-8"),'html.parser') #通过正则表达式匹配评论和评分 for item in soup.find_all(name='span',attrs={'class':re.compile(r'^allstar')}): sentiment.append(StartoSentiment(item['class'][0])) #for item in soup.find_all(name='p',attrs={'class':''}): # if str(item).find('class="pl"') < 0: # r = str(item.string).strip() # reviews.append(r) comments = soup.find_all('span','short') for comment in comments: # print(comment.getText()+'\n') reviews.append(comment.getText()+'\n') urlnumber = urlnumber + 20 time.sleep(5) with codecs.open(outfile, 'w', 'utf-8') as output: for i in range(len(sentiment)): output.write(reviews[i] + '\t' + str(sentiment[i]) + '\n') return (reviews, sentiment) ``` ![图片说明](https://img-ask.csdn.net/upload/201912/12/1576149313_611712.jpg) 不设置参数proxies时错误如下:![图片说明](https://img-ask.csdn.net/upload/201912/12/1576149408_985833.jpg) 求教解决方法,感谢!!!!
echarts 饼状图动态加载数据 图形不显示
function Get() { $.ajax({ type: "post", url: "@Url.Action("GetPieSeriesData", "ChartReport")", dataType: "text", data: { deptID: 1012 }, success: function (d) { var data = $.parseJSON(d); var arrNum = []; for (var i = 0; i < data.body.length; i++) { arrNum.push({ value: data.body[i].Value, name: data.body[i].Name }); } alert(JSON.stringify(arrNum)) return arrNum; }, error: function () { $.alter.error("数据结构加载失败!"); } }); } $(function () { var $tab1 = document.getElementById("tab1-container"); var tab2Option = { title: { text: '某站点用户访问来源', subtext: '纯属虚构', x: 'center' }, tooltip: { trigger: 'item', formatter: "{a} <br/>{b} : {c} ({d}%)" }, legend: { orient: 'vertical', left: 'left', data: ['正常', '故障', '维修', '报废'] }, series: [{ name: '访问来源', type: 'pie', radius: '55%', roseType: 'angle', data:Get(), itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } }] }; echarts.dispose($tab1); var tab1Table = echarts.init($tab1); tab1Table.setOption(tab2Option,true);
注释一段PHP代码,能翻译成C#最好
``` function pinyin($s, $isfirst = false) { static $pinyins; $s = trim($s); $len = strlen($s); if($len < 3) return $s; if(!isset($pinyins)) { $data = '一:yi|丁:ding|丂:kao|七:qi|丄:shang|丅:xia|丆:mu|万:wan|丈:zhang|三:san|上:shang|下:xia|丌:ji|不:bu|与:yu|丏:mian|丐:gai|丑:chou|丒:chou|专:zhuan|且:qie|丕:pi|世:shi|丗:shi|丘:qiu|丙:bing|业:ye|丛:cong|东:dong|丝:si|丞:cheng|丟:diu|丠:qiu|両:liang|丢:diu|丣:you|两:liang|严:yan|並:bing|丧:sang|丨:gun|丩:jiu|个:ge|丫:ya|丬:zhuang|中:zhong|丮:ji|丯:jie|丰:feng|丱:guan|串:chuan|丳:chan|临:lin|丵:zhuo|丶:zhu|丷:ha|丸:wan|丹:dan|为:wei|主:zhu|丼:jing|丽:li|举:ju|丿:pie|乀:fu|乁:yi|乂:yi|乃:nai|乄:wu|久:jiu|乆:jiu|乇:tuo|么:me|义:yi|乊:ho|之:zhi|乌:wu|乍:zha|乎:hu|乏:fa|乐:le|乑:yin|乒:ping|乓:pang|乔:qiao|乕:hu|乖:guai|乗:cheng'; $a1 = explode('|', $data); $pinyins = array(); foreach($a1 as $v) { $a2 = explode(':', $v); $pinyins[$a2[0]] = $a2[1]; } } $rs = ''; for($i = 0; $i < $len; $i++) { $o = ord($s[$i]); if($o < 0x80) { if(($o >= 48 && $o <= 57) || ($o >= 97 && $o <= 122)) { $rs .= $s[$i]; // 0-9 a-z }elseif($o >= 65 && $o <= 90) { $rs .= strtolower($s[$i]); // A-Z }else{ $rs .= '_'; } }else{ $z = $s[$i].$s[++$i].$s[++$i]; if(isset($pinyins[$z])) { $rs .= $isfirst ? $pinyins[$z][0] : $pinyins[$z]; }else{ $rs .= '_'; } } } return $rs; } ```
Pie
Problem Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece of one pie, not several small pieces since that looks messy. This piece can be one whole pie though. My friends are very annoying and if one of them gets a bigger piece than the others, they start complaining. Therefore all of them should get equally sized (but not necessarily equally shaped) pieces, even if this leads to some pie getting spoiled (which is better than spoiling the party). Of course, I want a piece of pie for myself too, and that piece should also be of the same size. What is the largest possible piece size all of us can get? All the pies are cylindrical in shape and they all have the same height 1, but the radii of the pies can be different. Input One line with a positive integer: the number of test cases. Then for each test case: ---One line with two integers N and F with 1 <= N, F <= 10 000: the number of pies and the number of friends. ---One line with N integers ri with 1 <= ri <= 10 000: the radii of the pies. Output For each test case, output one line with the largest possible volume V such that me and my friends can all get a pie piece of size V. The answer should be given as a floating point number with an absolute error of at most 10^(-3). Sample Input 3 3 3 4 3 3 1 24 5 10 5 1 4 2 3 4 5 6 5 4 2 Sample Output 25.1327 3.1416 50.2655
open_flash_chart 通过js画饼图问题
我最近要做报表 发现open_flash_chart 挺好用,但是画饼图的时候发现饼图周围显示不了信息 js代码: <script type="text/javascript"> var so = new SWFObject("../actionscript/open-flash-chart.swf", "ofc", "500", "200", "9", "#FFFFFF"); //so.addVariable("data", "../data-files/data-20.txt"); so.addVariable("variables","true"); so.addVariable("title","中文,{font-size:30px; color:#000000}"); so.addVariable("pie","60,#9933CC,#000000"); so.addVariable("values","15,25,60"); so.addVariable("colours","#d01f3c,#356aa0,#C79810"); //so.addVariable("links","javascript:alert('15%25'),javascript:alert('25%25'),javascript:alert('60%25')"); so.addVariable("pie_labels","April,May,June"); //so.addVariable("tool_tip","#x_label#<br>Value: #val#%25"); so.addParam("allowScriptAccess", "always" );//"sameDomain"); so.write("my_chart"); </script> 下面是显示的图片
pie
Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece of one pie, not several small pieces since that looks messy. This piece can be one whole pie though. My friends are very annoying and if one of them gets a bigger piece than the others, they start complaining. Therefore all of them should get equally sized (but not necessarily equally shaped) pieces, even if this leads to some pie getting spoiled (which is better than spoiling the party). Of course, I want a piece of pie for myself too, and that piece should also be of the same size. What is the largest possible piece size all of us can get? All the pies are cylindrical in shape and they all have the same height 1, but the radii of the pies can be different. Input One line with a positive integer: the number of test cases. Then for each test case: ---One line with two integers N and F with 1 <= N, F <= 10 000: the number of pies and the number of friends. ---One line with N integers ri with 1 <= ri <= 10 000: the radii of the pies. Output For each test case, output one line with the largest possible volume V such that me and my friends can all get a pie piece of size V. The answer should be given as a floating point number with an absolute error of at most 10^(-3). Sample Input 3 3 3 4 3 3 1 24 5 10 5 1 4 2 3 4 5 6 5 4 2 Sample Output 25.1327 3.1416 50.2655
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、PDF搜索网站推荐 对于大部
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Vue + Spring Boot 项目实战(十四):用户认证方案与完善的访问拦截
本篇文章主要讲解 token、session 等用户认证方案的区别并分析常见误区,以及如何通过前后端的配合实现完善的访问拦截,为下一步权限控制的实现打下基础。
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入  假设现有4个人
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
SQL-小白最佳入门sql查询一
一 说明 如果是初学者,建议去网上寻找安装Mysql的文章安装,以及使用navicat连接数据库,以后的示例基本是使用mysql数据库管理系统; 二 准备前提 需要建立一张学生表,列分别是id,名称,年龄,学生信息;本示例中文章篇幅原因SQL注释略; 建表语句: CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // dosho
漫话:什么是平衡(AVL)树?这应该是把AVL树讲的最好的文章了
这篇文章通过对话的形式,由浅入深带你读懂 AVL 树,看完让你保证理解 AVL 树的各种操作,如果觉得不错,别吝啬你的赞哦。 1、若它的左子树不为空,则左子树上所有的节点值都小于它的根节点值。 2、若它的右子树不为空,则右子树上所有的节点值均大于它的根节点值。 3、它的左右子树也分别可以充当为二叉查找树。 例如: 例如,我现在想要查找数值为14的节点。由于二叉查找树的特性,我们可...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
开源并不是你认为的那些事
点击上方蓝字 关注我们开源之道导读所以 ————想要理清开源是什么?先要厘清开源不是什么,名正言顺是句中国的古代成语,概念本身的理解非常之重要。大部分生物多样性的起源,...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
      11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下
《C++ Primer》学习笔记(六):C++模块设计——函数
专栏C++学习笔记 《C++ Primer》学习笔记/习题答案 总目录 https://blog.csdn.net/TeFuirnever/article/details/100700212 —————————————————————————————————————————————————————— 《C++ Primer》习题参考答案:第6章 - C++模块设计——函数 文章目录专栏C+...
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车? 某胡同口的煎饼摊一年能卖出多少个煎饼? 深圳有多少个产品经理? 一辆公交车里能装下多少个乒乓球? 一
so easy! 10行代码写个"狗屁不通"文章生成器
前几天,GitHub 有个开源项目特别火,只要输入标题就可以生成一篇长长的文章。背后实现代码一定很复杂吧,里面一定有很多高深莫测的机器学习等复杂算法不过,当我看了源代码之后这程序不到50
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
相关热词 c# 图片上传 c# gdi 占用内存 c#中遍历字典 c#控制台模拟dos c# 斜率 最小二乘法 c#进程延迟 c# mysql完整项目 c# grid 总行数 c# web浏览器插件 c# xml 生成xsd
立即提问