影在南城吧 关注:44贴子:11,298
  • 12回复贴,共1
http://www.codeceo.com/article/sort-csharp.html 冒泡法排序
for (int i = 0; i < arry.Length; i++)
{
for (int j = 0; j < arry.Length - 1 - i; j++)
{
//比较相邻的两个元素,如果前面的比后面的大,则交换位置
if (arry[j] > arry[j + 1])
{
int temp = arry[j + 1];
arry[j + 1] = arry[j];
arry[j] = temp;
}
}
}


IP属地:北京1楼2016-10-19 10:02回复
    1 int a, b, temp
    2 a = 10;
    3 b = 5;
    4 temp = a;
    5 a = b;
    6 b = temp;
    1 int a, b;
    2 a = 10;
    3 b = 2;
    4 a = b - a;//a=-8,b=10
    5 b = b - a;//a=-8,b=10
    6 a = b + a;//a=2,b=10 交换成功


    IP属地:北京2楼2016-10-19 10:03
    回复
      js中二维数组?
      var i = [];
      i.push([1,2,3,4]);
      i.push([5,6,7,8]);
      alert(i[0][1]);


      IP属地:北京3楼2016-10-19 10:03
      回复
        HighCharts之2D圆环图
        http://blog.csdn.net/you23hai45/article/details/22444139
        <!DOCTYPE html>
        <html>
        <head>
        <meta charset="UTF-8">
        <title>HighCharts 2D圆环图</title>
        <script type="text/javascript" src="../scripts/jquery-1.11.0.js"></script>
        <script type="text/javascript" src="../scripts/js/highcharts.js"></script>
        <script type="text/javascript">
        $(function(){
        var colors = Highcharts.getOptions().colors,
        categories = ['花', '树', '鱼', '鸟', '鲸'],
        name = 'Browser brands',
        data = [{
        y: 55.11,
        color: colors[0],
        drilldown: {
        name: '花的种类',
        categories: ['梅花', '桃花', '梨花', '樱花'],
        data: [13.6, 7.35, 33.06, 2.81],
        color: colors[0]
        }
        }, {
        y: 21.63,
        color: colors[1],
        drilldown: {
        name: '树的种类',
        categories: ['樟树', '桉树', '茶树', '桃树', '梨树'],
        data: [15.20, 3.83, 18.58, 13.12, 45.43],
        color: colors[1]
        }
        }, {
        y: 11.94,
        color: colors[2],
        drilldown: {
        name: '鱼的种类',
        categories: ['鲫鱼', '鲢鱼', '草鱼', '青鱼', '鲦鱼','鳙鱼', '鲥鱼'],
        data: [41.12, 10.19, 11.12, 14.36, 21.32, 9.91, 17.50],
        color: colors[2]
        }
        }, {
        y: 7.15,
        color: colors[3],
        drilldown: {
        name: '鸟的种类',
        categories: ['松鸡', '卷尾', '鹪鹩', '岩鹨', '山鹑','画眉', '金鸡'],
        data: [14.55, 19.42, 16.23, 16.21, 18.20, 23.19, 10.14],
        color: colors[3]
        }
        }, {
        y: 2.14,
        color: colors[4],
        drilldown: {
        name: '鲸的种类',
        categories: ['须鲸', '蓝鲸', '虎鲸'],
        data: [ 24.12, 18.37, 32.65],
        color: colors[4]
        }
        }];
        // 构建物种数据
        var speciesData = [];
        var speData = [];
        for (var i = 0; i < data.length; i++) {
        // 添加物种数据
        speciesData.push({
        name: categories[i],
        y: data[i].y,
        color: data[i].color
        });
        for (var j = 0; j < data[i].drilldown.data.length; j++) {
        var brightness = 0.4 - (j / data[i].drilldown.data.length) / 5 ;
        speData.push({
        name: data[i].drilldown.categories[j],
        y: data[i].drilldown.data[j],
        color: Highcharts.Color(data[i].color).brighten(brightness).get()
        });
        }
        }
        // 创建圆环图
        $('#donutChart').highcharts({
        chart: {
        type: 'pie'
        },
        title: {
        text: '物种数量及其比例'
        },
        yAxis: {
        title: {
        text: '比例'
        }
        },
        plotOptions: {
        pie: {
        shadow: true,
        center: ['50%', '50%']
        }
        },
        tooltip: {
        valueSuffix: '%'
        },
        series: [{
        name: '物种',
        data: speciesData,
        size: '70%',
        dataLabels: {
        formatter: function() {
        return this.y > 5 ? this.point.name : null;
        },
        color: 'white',
        distance: -30
        }
        }, {
        name: '数量',
        data: speData,
        size: '80%',
        innerSize: '80%',
        dataLabels: {
        formatter: function() {
        return this.y > 1 ? '<b>'+ this.point.name +':</b> '+ this.y +'%' : null;
        }
        }
        }]
        });
        });
        </script>
        </head>
        <body>
        <div id="donutChart" style="width: 1250px; height: 550px; margin: 0 auto"></div


        IP属地:北京4楼2016-10-19 10:04
        回复
          http://jingyan.baidu.com/article/fedf07375f885035ad89774b.html
          highcharts图表之饼图pie


          IP属地:北京5楼2016-10-19 10:05
          回复
            用js实现动态添加表格数据
            <!DOCTYPE HTML>
            <html>
            <head>
            <meta charset=UTF-8>
            <title>table</title>
            <style>
            table {
            margin:auto;
            width: 60%;
            border: 1px solid black;
            border-collapse: collapse;
            }
            table caption {
            color: blue;
            font: 34px consolas bold;
            }
            table th, table td {
            border: 1px solid black;
            text-align:center;
            }
            table th {
            font: 20px consolas bold;
            background-color: gray;
            }
            table tr:nth-child(n+2){
            background-color: cyan;
            }
            table tr:nth-child(2n+2) {
            background-color: red;
            }
            </style>
            <script>
            var data = [
            {id: "001", fullname: "张三", sex: "男", score: [98,33,48]},
            {id: "002", fullname: "李四", sex: "w", score: [11,22,33]},
            {id: "003", fullname: "kyo", sex: "m", score: [22,33,55]},
            {id: "004", fullname: "yamazaki", sex: "w", score: [99, 100, 80]}
            ];
            var Student = function (id, fullname, sex, score)
            {
            this.id = id;
            this.fullname = fullname;
            this.sex = sex;
            this.score = score;
            }
            var Score = function (chinese, math, english)
            {
            this.chinese = chinese;
            this.math = math;
            this.english = english;
            }
            var students = [];
            for (var i = 0; i < data.length; i++)
            {
            var d = data[i];
            var s = d["score"];
            students.push(new Student (d["id"], d["fullname"], d["sex"], new Score(s[0], s[1], s[2])));
            }
            onload = function ()
            {
            var table = document.createElement("table");
            var tbody = document.createElement("tbody");
            table.appendChild(tbody);
            var caption = table.createCaption();
            caption.innerHTML = "学生成绩表";
            var tr = tbody.insertRow (0);
            var str = "学号,姓名,性别,语文,数学,英语".split(",");
            for (var i = 0; i < str.length; i++)
            {
            var th = document.createElement("th");
            th.innerHTML = str[i];
            tr.appendChild (th);
            }
            for (var i = 0; i < students.length; i++)
            {
            var tr = tbody.insertRow (tbody.rows.length);
            var obj = students[i];
            for (var p in obj)
            {
            var op = obj[p];
            if (p != "score")
            {
            var td = tr.insertCell (tr.cells.length);
            td.innerHTML = op;
            }
            else
            {
            for (var p in op)
            {
            var td = tr.insertCell (tr.cells.length);
            td.innerHTML = op[p];
            }
            }
            }
            }
            document.body.appendChild(table);
            }
            </script>
            <body>
            </body>
            </html>


            IP属地:北京6楼2016-10-19 10:27
            回复
              $('#myModal').modal({
              backdrop: 'static'
              })


              IP属地:北京8楼2016-12-13 10:19
              回复
                alter table aaa add name //aaa增加一列name
                alter table aaa drop column name //删除aaa表中的name列
                delete from tb_DepartProduct where DepartName='北汽越野分公司' // 删除DepartName='北汽越野分公司'的一行
                insert into 目标表 select * from 原表; //复制一部分数据到另一个表
                insert into tb_ProSenRelation(ProductName, ProductID, SensorName, SensorID, MediumID, DepartID, Ratio )
                values ( '宝马X3', 'P-0', '污水处理站用水', 'S-0-0-0-12', 'M-0', 'D-20', '1' ) //插入数据
                update [tb_ComDevice_Info] set 是否自动生成='Y' where 字段描述='字数'; //更改数据库某行某列
                ALTER TABLE table add COLUMN xx` VARCHAR( 100 ) AFTER yy ; //在yy列后增加xx列
                delete from tb_Sensor where len(SearchID)>'1' //删除SearchID长度大于1 的行
                select*from [tb_Sensor]order by SearchID //按SearchID 排序
                select * into tb_Sensor_FuZhi from tb_Sensor //把tb_Sensor表复制到tb_Sensor_FuZhi
                EXEC sp_rename tb_keykey1, tb_keykey //把tb_keykey1复制到tb_keykey
                exec sp_rename 'B.A','C,'column' // 把表B的列名A改为名C
                TRUNCATE TABLE tablename //清空表数据
                data = data.TrimEnd(new char[] { ',' }) //去掉最后一个字符串


                IP属地:北京9楼2016-12-13 10:20
                回复
                  $("#myModal_1").modal({
                  backdrop: false
                  })


                  IP属地:北京10楼2016-12-13 10:35
                  回复
                    最终只能研究一下源码了,发现可以在bootstrap.js文件900行后面添加如下代码,便可以实现垂直居中。
                    that.$element.children().eq(0).css("position", "absolute").css({"margin":"0px","top": function () {return (that.$element.height() - that.$element.children().eq(0).height()-40) / 2 + "px";},"left": function () {return (that.$element.width() - that.$element.children().eq(0).width()) / 2 + "px";}});
                    <div><button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Launch demo modal</button><!-- Modal --><div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h4 class="modal-title" id="myModalLabel">Modal title</h4></div><div class="modal-body">...</div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button><button type="button" class="btn btn-primary">Save changes</button></div></div><!-- /.modal-content --></div><!-- /.modal-dialog --></div><!-- /.modal --></div>


                    IP属地:北京11楼2016-12-13 11:09
                    回复
                      模态框去除阴影 可拖动
                      <script type="text/javascript">
                      $("#myModal_1").draggable({
                      handle: ".modal-header",
                      cursor: 'move',
                      refreshPositions: false
                      });
                      $("#myModal_1").modal({
                      backdrop: false
                      });
                      $('#myModal_1').modal('hide')
                      </script>


                      IP属地:北京12楼2016-12-13 11:10
                      回复
                        $('#myModal').modal({
                        backdrop: 'static'
                        })
                        $("#myModal").modal({
                        backdrop: false
                        })
                        $(function ()
                        { $("#myModal").modal();
                        });
                        $("#myModal").modal({
                        show:false
                        });
                        $('#myModal').modal('toggle')
                        $('#myModal').modal('show')
                        $('#myModal').modal('hide')


                        IP属地:北京13楼2016-12-13 11:10
                        回复
                          清除树
                          var x1 = $("#comInfor" + 7).combotree('getText');
                          var x2 = $("#comInfor" + 6).val();
                          var x3 = $("#comInfor" + 9).combotree('getText');
                          var x4 = $("#comInfor" + 8).val();
                          var x5 = $("#comInfor" + 14).combotree('getText');
                          var x6 = $("#comInfor" + 15).combotree('getText');
                          var x7 = $("#comInfor" + 16).combotree('getText');
                          var x8 = $("#comInfor" + 17).combotree('getText');
                          if (x1 == "") {}
                          else {
                          var node1 = $("#comInfor" + 7).combotree('tree').tree('find', x2);
                          $("#comInfor" + 7).combotree('tree').tree('uncheck', node1.target);
                          }
                          if ( x3 == "") { }
                          else {
                          var node2 = $("#comInfor" + 9).combotree('tree').tree('find', x4);
                          $("#comInfor" + 9).combotree('tree').tree('uncheck', node2.target);
                          }
                          var xx = ["x5", "x6", "x7", "x8"];
                          var dd = ["14", "15", "16", "17"];
                          for (var i = 0; i < xx.length; i++) {
                          if (xx[i] == "" ) { }
                          else {
                          $("#comInfor" + dd[i]).combotree("clear");
                          }
                          }


                          IP属地:北京15楼2016-12-13 18:32
                          回复