zoukankan      html  css  js  c++  java
  • 解决jqplot与jquery-ui导入必要包时的冲突

    解决jqplot与jquery-ui导入必要包时的冲突

    对于一个网页中,即要有jqplot的画图,又要有jquery-ui的风格显示!

    但在导入必要的包时,出现了问题!

    先导入jqplot的必要包:

    复制代码
    1 <link type="text/css" rel="stylesheet"  href="../css/jQuery/jqPlot/jquery.jqplot.min.css" />
    2 <link type="text/css" rel="stylesheet"    href="../css/jQuery/jqPlot/syntaxhighlighter/styles/shCoreDefault.min.css" />
    3 <link type="text/css" rel="stylesheet"    href="../css/jQuery/jqPlot/syntaxhighlighter/styles/shThemejqPlot.min.css" />
    4 <script type="text/javascript"  src="../js/excanvas.js"></script>
    5 <script type="text/javascript"  src="../js/jQuery/jquery.min.js"></script>
    6 <script type="text/javascript"    src="../js/jQuery/jqPlot/staticjquery.jqplot.min.js"></script>
    7 <script type="text/javascript"  src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shCore.min.js"></script>
    8 <script type="text/javascript"    src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
    9 <script type="text/javascript"    src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shBrushXml.min.js"></script>    
    复制代码

    再导入jquery-ui的必要包:

    1 <link rel="stylesheet" href="../css/bootstrap.min.css" media="screen">
    2 <link rel="stylesheet" href="../css/cupertino/jquer121y-ui-1.10.3.custom.css" />
    3 <link rel="stylesheet" href="../css/cupertino/button.select.css" />
    4 <script src="../jquery_ui/jquery-1.9.1.js"></script>
    5 <script src="../js/jquery-ui-1.10.3.custom.js"></script>
    6 <script src="../js/jquery.ui.datepicker-zh-TW.js"></script>

    这样子的话能有jquery-ui的样式,会画不出图表,想当然就是jquery-ui的必要包会跟jqplot的必要包起冲突,而进行覆盖!

    如果导入jquery-ui的必要包,再导入jqplot的必要时的顺序的话,这样不能有jquery-ui的样式,但却能画出图来!

    解决的方法!如下,将必要包进行混合:

    复制代码
     1 <link type="text/css" rel="stylesheet"  href="../css/jQuery/jqPlot/jquery.jqplot.min.css" />
     2 <link type="text/css" rel="stylesheet"    href="../css/jQuery/jqPlot/syntaxhighlighter/styles/shCoreDefault.min.css" />
     3 <link type="text/css" rel="stylesheet"    href="../css/jQuery/jqPlot/syntaxhighlighter/styles/shThemejqPlot.min.css" />
     4 <link rel="stylesheet" href="../css/bootstrap.min.css" media="screen">
     5 <link rel="stylesheet" href="../css/cupertino/jquer121y-ui-1.10.3.custom.css" />
     6 <link rel="stylesheet" href="../css/cupertino/button.select.css" />  
     7 
     8 <script src="../jquery_ui/jquery-1.9.1.js"></script>
     9 <script src="../js/jquery.ui.datepicker-zh-TW.js"></script>
    10 <script type="text/javascript"  src="../js/excanvas.js"></script>
    11 <script type="text/javascript"  src="../js/jQuery/jquery.min.js"></script>
    12 <script type="text/javascript"    src="../js/jQuery/jqPlot/staticjquery.jqplot.min.js"></script>
    13 <script type="text/javascript"  src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shCore.min.js"></script>
    14 <script type="text/javascript"    src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
    15 <script type="text/javascript"    src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shBrushXml.min.js"></script>    
    16 <script src="../js/jquery-ui-1.10.3.custom.js"></script>
    复制代码

     出现上面这样子将必要包导入时不会出现覆盖的情况,即能有jquery-ui的样式,但却能画出图来!

    简单的字母全排列问题—递归法和STL法

    问题描述:求全由小写字母组成的不超过200个字符序列的全排列
    如输入序列bbjd,排列结果为:
    bbdj
    bbjd
    bdbj
    bdjb
    bjbd
    bjdb
    dbbj
    dbjb
    djbb
    jbbd
    jbdb
    jdbb
     
    方法一:递归法
     
    代码如下:
     
    复制代码
    #include <stdio.h>
    
    int t[200];
    char s[200];
    int n = 0;
    
    void permutation(int i)
    {
        int k;
    
        // a~z的ASCII码在97到122之间
        for(k = 97; k < 123; k++)
        {
            if(t[k])
            {
                t[s[i] = k]--;
                permutation(i + 1);
                t[k]++;
            }
        }
    
        // 只有n个字母全部排好了才输出
        n - i || puts(s);
    }
    
    int main()
    {    
        int i;
    
        puts("Please Input letter sequence: ");
        gets(s);
    
        // t[]记录每个字母的出现频率
        // n为待排序列的长度
        for(i = 0; s[i] != ''; i++)
        {
            t[s[i]]++;
            n++;
        }
    
        puts("Permutation result: ");
        permutation(0);
    
        return 0;
    }
    复制代码

    运行结果如下:

    方法二:STL法

    C++的STL有一个函数可以方便地生成全排列,这就是next_permutation

    在C++ Reference中查看了一下next_permutation的函数声明:

    #include <algorithm>
    bool next_permutation( iterator start, iterator end );

    The next_permutation() function attempts to transform the given range of elements [start,end) into the next lexicographically greater permutation of elements. If it succeeds, it returns true, otherwise, it returns false.

    从说明中可以看到 next_permutation 的返回值是布尔类型。按照提示写了一个标准C++程序:

    其中用到了 sort 函数,如果不先排序,则完成不了全排列。

    复制代码
    #include <iostream>
    #include <string>
    #include <algorithm>
    
    using namespace std;
    
    int main()
    {
        string str;
    
        cout << "Please Input letter sequence: 
    ";
        cin >> str;
        
        // 必须先排序
        sort(str.begin(), str.end());
        cout << str << endl;
    
        cout << "Permutation result: 
    ";
    
        while(next_permutation(str.begin(), str.end()))
        {
            cout << str << endl;
        }
    
        return 0;
    }
    复制代码

    运行结果如下:

    在使用稍大数据测试的时候,发现标准C++的效率很差,换成C函数写一下,效率提升了许多倍,比如我用字符序列“aabbddef”作为测试,上面C++代码用了6s,而下面的C代码只用了0.918s。所以,平时写代码时能用C就用C。

    复制代码
    #include <stdio.h>
    #include <algorithm>
    
    using namespace std;
    
    int main()
    {
        char str[200];
        int len;
    
        puts("Please Input letter sequence: ");
        gets(str);
    
        len = strlen(str);
        
        // 必须先排序
        sort(str, str + len);
    
        puts("Permutation result: ");
        puts(str);
    
        while(next_permutation(str, str + len))
        {
            puts(str);
        }
    
        return 0;
    }
    复制代码
     
     
    分类: htmljqplotjsp
    标签: jqplotjquery-ui
  • 相关阅读:
    【全程NOIP计划】分治与倍增
    apple id 后端验证 django
    安装Tomcat8,在Eclipse中配置Tomcat8
    CURL并发测试POST和DELETE请求
    curl如何发起DELETE/PUT请求?(备忘)
    Ubuntu 11.10下安装配置Zend Studio 9.0破解版详细步骤
    RTP QOS
    RTCP
    DirectDraw基础篇
    RTSP简介
  • 原文地址:https://www.cnblogs.com/Leo_wl/p/3300010.html
Copyright © 2011-2022 走看看