月度归档: 2022 年 2 月

  • mysql导入sql文件的时候报告ERROR: ASCII ‘\0’ appeared in the statement

    mysql导入sql文件的时候报告ERROR: ASCII ‘\0’ appeared in the statement

    问题描述

    今天导入SQL文件,但是执行的时候发现如下错误提示:

    ERROR: 
    ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: ''.
    Bye

    解决办法

    登入的时候加–binary-mode=1

    mysql --binary-mode=1 -h127.0.0.1 -uroot -p123456 -P3306
    mysql> use db;
    mysql> source /data/jiloc.sql

  • 2022腾讯云新春采购 云服务器低至200元/三年

    2022腾讯云新春采购 云服务器低至200元/三年

    腾讯云服务商开启新的2022年新春采购活动,今年的优惠力度还是比较大的。老季看到一如即往的新用户专享、新产品首购等活动,云服务器低至三年200元,包括有企业专享优惠、新老用户回购优惠,以及还有各种代金券和返利活动。

    活动截止到3月31日,如果我们有需要新年采购的,这次力度应该是上半年比较低的。建议准备好新账户享受新客优惠活动新品首购优惠。

    2022腾讯云新春特惠购买直达链接:https://www.jiloc.com/go/qcloud-act

    每日秒杀活动

    爆款2核2G云服务器首年40元,每日2场秒杀。老季建议我们尽量的选择三年套餐,这样力度更低。

    轻量服务器对于一般的用户来说是足够用的,而且带宽足够大,比云服务器CVM还要性价比高。

    企业用户专享

    企业专属优惠1折起,首购订单达标赢300元京东卡。

    企业用户在2022新春活动页完成首购且首购订单金额达到指定门槛,即有资格获得对应面额京东卡。每个实名认证主体、每个手机号限领1次,奖励不叠加,如1个实名认证主体或1个手机号下多个账号符合条件,以最高奖励金额为准。

    新老用户活动

    百款云产品4折起,订单满额兑换代金券和周边好礼。

    我们看到还有云服务器、数据库、CDN安全等等,均可有优惠。

    满额兑换

    活动订单满额即可兑换腾讯云代金券和周边好礼,礼品可叠加,每类礼品限兑换一次

    用户在2022新春活动页订单金额达到指定门槛,即有资格兑换礼品,礼品可叠加,每类礼品每个账号限兑换一次。

    代金券领取

    个人和企业领取代金券,一键领取大额代金券,总价值8888元,新购、续费、升级不用愁。

  • Akamai收购Linode 巩固云服务器CDN和安全解决方案

    Akamai收购Linode 巩固云服务器CDN和安全解决方案

    2022年春节之后,收到Linode云服务器的邮件,关于Akamai收购Linode的信息说明。

    Akamai 商家主要是提供云服务器安全解决方案的,比如CDN等。在Linode收购之后,将会继续保持Akamai的产品优势且会和Linode的云服务器等相关的云产品融合提供更多的适合云产品和服务的解决方案,这样可以用来弥补Linode商家在安全方面的产品广度。具体的部署和产品融合将会在第一季度完成,我们一起期待吧。这里老季一并将这封邮件分享出来。

    邮件原文:

    I am excited to announce that Linode has entered into an agreement to be acquired by Akamai. You can read the official press release in our press room.

    First things first: For the immediate future, we will continue to operate as we always have. Akamai has no intention of changing what has made us successful. This acquisition will propel us both forward — not take anything away. Linode will soon be able to call on the power of Akamai to offer entirely new products, services, expertise, locations, and scale, while Akamai will be able to tap into Linode’s deep expertise in compute, storage, and on-demand infrastructure-as-a-service.

    If you don’t already know Akamai, they’ve been around since the early days of the web. They invented the CDN and operate the world’s most sophisticated content delivery platform. Over the years, they’ve added world class security and edge solutions to their portfolio, among other things.

    There is natural synergy between Akamai and Linode, not only in our missions and cultures, but in the potent combination of strengths we each bring to the table. Combining Linode’s compute and storage products with Akamai’s serverless, CDN, and security solutions, will give customers a broader range of services to build, modernize, and scale the next generation of applications.

    Today, we start a new chapter in Linode’s story – one that strengthens our position in a market increasingly looking for alternatives. The transaction is expected to close in the first quarter of 2022. In the meantime, we want to thank you — our customers — for supporting and empowering us to make cloud computing simple, affordable, and accessible.

    翻译如下:

    我很高兴地宣布,Linode已与Akamai达成收购协议。您可以在我们的新闻发布室阅读官方新闻稿。

    首先,在不久的将来,我们将一如既往地继续运营。Akamai无意改变让我们成功的东西。这次收购将推动我们双方向前发展,而不是带走任何东西。Linode将很快能够调用Akamai的力量,提供全新的产品、服务、专业知识、位置和规模,而Akamai将能够利用Linode在计算、存储和按需基础设施即服务方面的深厚专业知识。

    如果你还不知道Akamai,那么我告诉你,他们在早期的网络时代就已经存在了。他们发明了CDN,并运营着世界上最复杂的内容交付平台。多年来,他们已经为他们的投资组合添加了世界级的安全和边缘解决方案。

    Akamai和Linode之间有着天然的协同作用,这不仅体现在我们的使命和文化上,而且体现在我们各自带来的强大力量的结合上。将Linode的计算和存储产品与Akamai的无服务器、CDN和安全解决方案相结合,将为客户提供更广泛的服务,以构建、现代化和扩展下一代应用程序。

    今天,我们开始了Linode故事的新篇章——在一个日益寻找替代产品的市场中巩固我们的地位。该交易预计将于2022年第一季度完成。

  • javascript代码实现 随机漂浮的广告图片 代码实例

    javascript代码实现 随机漂浮的广告图片 代码实例

    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>js随机飘动的广告图片代码</title>
        </head>
        <body> 
           <div id="main" style="position:absolute;">
                <div style="text-align:right;cursor:pointer;" id="close">关闭</div>
                <a href="" target="_blank"><img src="图片地址.jpg" border="0" width="214" height="73" /></a>
            </div>
        </body>
    </html>
    <script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
    <script>
        <!--//公共脚本文件 main.js
        function addEvent(obj, evtType, func, cap) {
            cap = cap || false;
            if (obj.addEventListener) {
                obj.addEventListener(evtType, func, cap);
                return true;
            } else if (obj.attachEvent) {
                if (cap) {
                    obj.setCapture();
                    return true;
                } else {
                    return obj.attachEvent("on" + evtType, func);
                }
            } else {
                return false;
            }
        }
        function removeEvent(obj, evtType, func, cap) {
            cap = cap || false;
            if (obj.removeEventListener) {
                obj.removeEventListener(evtType, func, cap);
                return true;
            } else if (obj.detachEvent) {
                if (cap) {
                    obj.releaseCapture();
                    return true;
                } else {
                    return obj.detachEvent("on" + evtType, func);
                }
            } else {
                return false;
            }
        }
        function getPageScroll() {
            var xScroll, yScroll;
            if (self.pageXOffset) {
                xScroll = self.pageXOffset;
            } else if (document.documentElement && document.documentElement.scrollLeft) {
                xScroll = document.documentElement.scrollLeft;
            } else if (document.body) {
                xScroll = document.body.scrollLeft;
            }
            if (self.pageYOffset) {
                yScroll = self.pageYOffset;
            } else if (document.documentElement && document.documentElement.scrollTop) {
                yScroll = document.documentElement.scrollTop;
            } else if (document.body) {
                yScroll = document.body.scrollTop;
            }
            arrayPageScroll = new Array(xScroll, yScroll);
            return arrayPageScroll;
        }
        function GetPageSize() {
            var xScroll, yScroll;
            if (window.innerHeight && window.scrollMaxY) {
                xScroll = document.body.scrollWidth;
                yScroll = window.innerHeight + window.scrollMaxY;
            } else if (document.body.scrollHeight > document.body.offsetHeight) {
                xScroll = document.body.scrollWidth;
                yScroll = document.body.scrollHeight;
            } else {
                xScroll = document.body.offsetWidth;
                yScroll = document.body.offsetHeight;
            }
            var windowWidth, windowHeight;
            if (self.innerHeight) {
                windowWidth = self.innerWidth;
                windowHeight = self.innerHeight;
            } else if (document.documentElement && document.documentElement.clientHeight) {
                windowWidth = document.documentElement.clientWidth;
                windowHeight = document.documentElement.clientHeight;
            } else if (document.body) {
                windowWidth = document.body.clientWidth;
                windowHeight = document.body.clientHeight;
            }
            if (yScroll < windowHeight) {
                pageHeight = windowHeight;
            } else {
                pageHeight = yScroll;
            }
            if (xScroll < windowWidth) {
                pageWidth = windowWidth;
            } else {
                pageWidth = xScroll;
            }
            arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight)
            return arrayPageSize;
        }
        var AdMoveConfig = new Object();
        AdMoveConfig.IsInitialized = false;
        AdMoveConfig.AdCount = 0;
        AdMoveConfig.ScrollX = 0;
        AdMoveConfig.ScrollY = 0;
        AdMoveConfig.MoveWidth = 0;
        AdMoveConfig.MoveHeight = 0;
        AdMoveConfig.Resize = function () {
            var winsize = GetPageSize();
            AdMoveConfig.MoveWidth = winsize[2];
            AdMoveConfig.MoveHeight = winsize[3];
            AdMoveConfig.Scroll();
        }
        AdMoveConfig.Scroll = function () {
            var winscroll = getPageScroll();
            AdMoveConfig.ScrollX = winscroll[0];
            AdMoveConfig.ScrollY = winscroll[1];
        }
        addEvent(window, "resize", AdMoveConfig.Resize);
        addEvent(window, "scroll", AdMoveConfig.Scroll);
        function AdMove(id, addCloseButton) {
            if (!AdMoveConfig.IsInitialized) {
                AdMoveConfig.Resize();
                AdMoveConfig.IsInitialized = true;
            }
            AdMoveConfig.AdCount++;
            var obj = document.getElementById(id);
            obj.style.position = "absolute";
            var W = AdMoveConfig.MoveWidth - obj.offsetWidth;
            var H = AdMoveConfig.MoveHeight - obj.offsetHeight;
            var x = W * Math.random(), y = H * Math.random();
            var rad = (Math.random() + 1) * Math.PI / 6;
            var kx = Math.sin(rad), ky = Math.cos(rad);
            var dirx = (Math.random() < 0.5 ? 1 : -1), diry = (Math.random() < 0.5 ? 1 : -1);
            var step = 1;
            var interval;
            if (addCloseButton) {
                var closebtn = document.createElement("div");
                obj.appendChild(closebtn);
                closebtn.onclick = function () {
                    obj.style.display = "none";
                    clearInterval(interval);
                    closebtn.onclick = null;
                    obj.onmouseover = null;
                    obj.onmouseout = null;
                    obj.MoveHandler = null;
                    AdMoveConfig.AdCount--;
                    if (AdMoveConfig.AdCount <= 0) {
                        removeEvent(window, "resize", AdMoveConfig.Resize);
                        removeEvent(window, "scroll", AdMoveConfig.Scroll);
                        AdMoveConfig.Resize = null;
                        AdMoveConfig.Scroll = null;
                        AdMoveConfig = null;
                    }
                }
            }
            obj.MoveHandler = function () {
                obj.style.left = (x + AdMoveConfig.ScrollX) + "px";
                obj.style.top = (y + AdMoveConfig.ScrollY) + "px";
                rad = (Math.random() + 1) * Math.PI / 6;
                W = AdMoveConfig.MoveWidth - obj.offsetWidth;
                H = AdMoveConfig.MoveHeight - obj.offsetHeight;
                x = x + step * kx * dirx;
                if (x < 0) { dirx = 1; x = 0; kx = Math.sin(rad); ky = Math.cos(rad); }
                if (x > W) { dirx = -1; x = W; kx = Math.sin(rad); ky = Math.cos(rad); }
                y = y + step * ky * diry;
                if (y < 0) { diry = 1; y = 0; kx = Math.sin(rad); ky = Math.cos(rad); }
                if (y > H) { diry = -1; y = H; kx = Math.sin(rad); ky = Math.cos(rad); }
            }
            this.SetLocation = function (vx, vy) { x = vx; y = vy; }
            this.SetDirection = function (vx, vy) { dirx = vx; diry = vy; }
            this.Run = function () {
                var delay = 10;
                interval = setInterval(obj.MoveHandler, delay);
                obj.onmouseover = function () { clearInterval(interval); }
                obj.onmouseout = function () { interval = setInterval(obj.MoveHandler, delay); }
            }
        }
        //-->
    </script>
    <script type="text/javascript">
        $(function() {
            $("#close").click(function() {
                $("#main").hide();
            });
        })
        var ad1 = new AdMove("main", true);
        ad1.Run();
    </script>
  • MySQL 字符串类型转换为数字 排序操作

    MySQL 字符串类型转换为数字 排序操作

    最近项目中在写sql时,遇到要按字符串类型的数字排序,直接排序不行,那就需要把字符串类型转换成数字后,再进行排序。

    字符串格式的话排序是这样的:

    1 10 11 12 2 20 21 …

    这种排列顺序不是我们想要的。

    想要转化成数字,变成 1 2 10 11 20 21 的顺序。

    三种解决方法:

    1.数字后面直接加0,即:(value+0)格式

    select * from sys_user order by (sort+0) desc

    2.使用cast()函数,即:cast(value as type)格式

    select * from sys_user order by cast(sort as signed) desc

    3.使用convert()函数,即:convert(value , type)格式

    select * from sys_user order by convert(sort , signed) desc

    备注:value 代表字符串类型的字段 ,type代表要转换的类型 signed为整数类型

WeChat