2019年4月

小编最近在做python的开发,大家都知道python都是利用缩进来区分的代码块。小编在利用sublime开发的时候发现一个tab的的距离和四个空格的距离是相等的,但是呢,却不是四个空格的格式。这样python就回出现缩进错误。
下面小编说下解决的方案:
首先打开你的设置:
打开方式:Perferences->Settings(mac里面是Setting,windows里面应该是Setting-Use)
在你的个人设置里面添加如下内容:

"tab_size": 4,
"translate_tabs_to_spaces": true,
"expand_tabs_on_save": true

最终的user的设置就就变成以下的样子:

{
    "font_size": 20,
    "ignored_packages":
    [
        "Vintage"
    ],
       "tab_size": 4,
       "translate_tabs_to_spaces": true,
       "expand_tabs_on_save": true
}

安装Python2.7的虚拟环境

因为python的框架的版本更新换代很快,而且很多版本之间不兼容,所以通过python的虚拟环境来进行区分。
操作:

  • 安装打开mac的终端,执行pip install virtualenv
  • 创建执行virtualenv venv
  • 激活执行source venv/bin/activate
  • 退出执行deactivate

安装Flask

  • 执行:pip install Flask
  • 启动flask

    export FLASK_APP=flaskr
    export FLASK_ENV=development //打开所有开发功能(包括调试模式)
    flask run

前提:这两个微信小程序必须是同一公众号绑定的小程序。
操作

  • 首先在app.json配置文件里面配置好要跳转的微信小程序的appid

    "navigateToMiniProgramAppIdList": [ "微信小程序的appid" ] 
  • 设置跳转的事件

    • navigator跳转

        <navigator target="miniProgram" open-type="navigate" app-id="要跳转的小程序的appid" path="要跳转的页面" extra-data="" version="release">打开绑定的小程序</navigator>
    • 点击跳转

      wx.navigateToMiniProgram({
        appId: 小程序appid,
        path: 要跳转的页面,
        extraData: {
          // from: 'xxxxx'
        },
        envVersion: 'develop',
        success(res) {
          // 打开其他小程序成功同步触发
           wx.showToast({
             title: '跳转成功'
           })
        }
      })

首先进行下载:

下载地址:https://redis.io/download

解压

tar zxvf redis-4.0.9.tar.gz

移动到安装位置

mv redis-4.0.9 /usr/local/

进入安装目录

cd /usr/local/redis-4.0.9/

编译安装

sudo make install

小编的电脑为炫龙毁灭者的,想尝试下双系统,所以今天就安装了了一个Ubuntu18.04的系统,结果卡在了logo界面。下面说下解决方案。因为不太好截图就没有截图了。
原因分析:因为Ubuntu默认内置了Nvidia的第三方开源驱动nouveau,所以会卡死在logo界面。
解决办法:禁用呗。
详细办法:

  • 如果卡死在logo界面时,直接强制关机,然后再重新开机,否则这步可以略过。
  • 在选择具体步骤的grub引导界面时,选择第二行Install Ubuntu的那个界面,先用方向键选到第二行Install,不要立即按回车,而是按E,就进入参数配置编辑界面。
  • 找到开头是linux的末尾是quiet splash的那一行,在末尾quiet splash的后面先空一格删除 再加上 nomodeset
  • 然后按F10即可进入正常的安装流程,联网安装的时候可以让系统自动安装一个显卡驱动。

小编今天帮朋友解决了一个数据库出现了一个数据库时区的错误问题:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time
解决办法:
控制台执行以下命令

show variables like '%time_zone%';
set global time_zone='+8:00';

也许是由于版本的原因,把SpringBoot2的改为了SpringBoot1.5,发现在swagger这个接口文档突然不能用了。出现了下面的错误

Unable to infer base url. This is common when using dynamic servlet registration or when the API is behind an API Gateway. The base url is the root of where all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs then the base url is http://example.org/api/. Please enter the location manually:

解决办法:
在ApiApplication里面添加@EnableSwagger2

SpringBoot开启日志
在SpringBoot的配置文件application.properties文件里加入以下内容

#com.mycompany.mavenspringboot.controller 日志 WARN级别输出
logging.level.com.univalsoft.api.controller=WARN
#com.mycompany.mavenspringboot.mapper sql日志 DEBUG级别输出
logging.level.com.mycompany.mavenspringboot.mapper=DEBUG

logging.file=logs/spring-boot-logging.log
logging.pattern.console=%d{yyyy/MM/dd-HH:mm:ss} [%thread] %-5level %logger- %msg%n
logging.pattern.file=%d{yyyy/MM/dd-HH:mm} [%thread] %-5level %logger- %msg%n