Save
Saving
  • Zero

        AnimationController _panelAnimationController;
        _panelAnimationController = new AnimationController(
          vsync: this,
          duration: new Duration(milliseconds: 300),
        );
        Animation<double> animation =
            new Tween(begin: 300.0, end: 0.0).animate(_panelAnimationController);
        animation.addStatusListener((status) {
          if (status == AnimationStatus.completed) {
            //动画执行结束时反向执行动画
            _panelAnimationController.reverse();
          } else if (status == AnimationStatus.dismissed) {
            //动画恢复到初始状态时执行动画(正向)
            _panelAnimationController.forward();
          }
        });
        animation.addListener(() {
          print(animation.value);
        });
        _panelAnimationController.forward();
    

    posted in GuaiK实验室 read more
  • Zero

    下载地址:
    http://waon.sourceforge.net/#download


    依赖库安装:(Mac OS)

    brew install fftw
    brew install libsndfile
    

    编译:

    make --makefile=Makefile.waon
    

    posted in GuaiK实验室 read more
  • Zero

    CMake是一个很便捷的跨平台编译工具,只要把目录结构排版好,写一个CMakeLists.txt告诉CMake怎么去生成makefile就ok了。


    基本用法

    # 目录结构
    -/ *(根目录)
    |-CMakeLists.txt
    |-main.cpp
    |-ios.toolchain.cmake *(可选项,用来编译ios项目用,下面会提供下载地址)
    |-build *(用来存放编译后可执行文件的目录)
    |-library *(用来存放编译后生成静态库的目录)
    |-utils *(utils静态库源码目录)
        |-CMakeLists.txt
        |-utils.cpp
        |-mem.cpp
        |-utils.h
        |-mem.cpp
    

    根目录中的CMakeLists.txt

    # 项目名称
    project(ANLib)
    # 设置CMake最小版本
    cmake_minimum_required(VERSION 2.8)
    set(CMAKE_MACOSX_RPATH 0)
    # 代码路径
    aux_source_directory(. test_src)
    #设置编译器
    set(CMAKE_CXX_COMPILER "g++")
    #设置构建类型,及相应的编译选项
    set(CMAKE_BUILD_TYPE "Release")
    set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb -m64")
    set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -m64")
    
    #设置执行文件输出目录
    set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build)
    #设置库输出路径
    set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/library)
    
    #设置utils库源码路径
    set(utils_dir ./utils)
    add_subdirectory(${utils_dir})
    include_directories(${utils_dir})
    
    link_directories(${PROJECT_SOURCE_DIR}/library)
    
    # 生成可执行的文件
    add_executable(test ${test_src})
    target_link_libraries(test utils)
    
    

    utils目录中的CMakeLists.txt

    set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/library)
    aux_source_directory(. dir_srcs)
    add_library(utils STATIC ${dir_srcs})
    target_link_libraries(utils)
    

    开始使用Cmake

    切换到根目录中,编译项目:

    cmake .
    make
    

    在mac中使用cmake编译ios的静态库:(需要mac os系统)

    clone以下项目,让后将’ios.toolchain.cmake’放到根目录中(以下链接选一个下载)
    https://code.google.com/archive/p/ios-cmake/downloads
    https://github.com/leetal/ios-cmake

    切换到根目录中,编译项目:

    cmake . -DCMAKE_TOOLCHAIN_FILE=./ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR64
    make
    

    相关选项说明:

    Set -DIOS_PLATFORM to "SIMULATOR" to build for iOS simulator 32 bit (i386) DEPRECATED
    Set -DIOS_PLATFORM to "SIMULATOR64" (example above) to build for iOS simulator 64 bit (x86_64)
    Set -DIOS_PLATFORM to "OS" to build for Device (armv7, armv7s, arm64, arm64e)
    Set -DIOS_PLATFORM to "OS64" to build for Device (arm64, arm64e)
    Set -DIOS_PLATFORM to "TVOS" to build for tvOS (arm64)
    Set -DIOS_PLATFORM to "SIMULATOR_TVOS" to build for tvOS Simulator (x86_64)
    Set -DIOS_PLATFORM to "WATCHOS" to build for watchOS (armv7k, arm64_32)
    Set -DIOS_PLATFORM to "SIMULATOR_WATCHOS" to build for watchOS Simulator (x86_64)
    

    posted in GuaiK实验室 read more
  • Zero

    import 'package:flutter/services.dart';
    
    void main() {
      // 强制竖屏
      SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
          .then((_) {
        runApp(MainApp());
      });
    }
    

    posted in GuaiK实验室 read more
  • Zero

    使用Gitlab内置的Nginx服务

    1、去官网下载最新版的Gitlab软件,根据操作系统选择:(我的是CentOS7,选择rpm x64安装包)
    https://packages.gitlab.com/gitlab/gitlab-ce

    wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-11.7.5-ce.0.el7.x86_64.rpm/download.rpm
    

    2、安装依赖包和相关配置

    sudo yum install -y curl policycoreutils-python openssh-server
    sudo yum install postfix
    sudo systemctl enable postfix
    sudo systemctl start postfix
    sudo systemctl enable sshd
    sudo systemctl start sshd
    sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent  
    sudo firewall-cmd --zone=public --add-port=8081/tcp --permanent  
    sudo firewall-cmd --reload
    

    3、安装Gitlab

    rpm -i gitlab-ce-11.7.5-ce.0.el7.x86_64.rpm
    

    4、配置Gitlab,监听8080端口

    vi /etc/gitlab/gitlab.rb
    #=======================
    # 修改external_url,修改成你服务器的ip地址,如:external_url 'http://192.168.1.xxx'
    # 查找所有8080端口,共3个,全部改成8081
    # 查找nginx['listen_port'],将Nginx监听端口修改成8080
    

    5、重启Gitlab服务器

    sudo gitlab-ctl reconfigure
    sudo gitlab-ctl restart
    

    6、用浏览器访问:
    http://192.168.1.xxx:8080

    可能出现问题的解决方案:

    安装过程中卡死不动,强制终止后运行下面指令

    sudo systemctl restart gitlab-runsvdir
    sudo gitlab-ctl reconfigure
    sudo gitlab-ctl restart
    

    网络错误日志调试

    gitlab-ctl tail
    

    使用ssh clone时报 Permission denied 的错误:

    cd ~/.ssh
    ssh-keygen -t rsa -C 'xxx@gmail.com'
    

    会生成id_rsa和id_rsa.pub,打开id_rsa.pub把里边所有的内容复制粘贴到gitlab的"SSH Keys"中,再次Clone就不会报错了。


    如果在复制clone的http的连接时发现里边没有端口号,可以在服务器编辑"/etc/gitlab/gitlab.rb"文件,在“external_url”地址后增加端口号,然后执行:

    sudo gitlab-ctl reconfigure
    sudo gitlab-ctl restart
    

    posted in GuaiK机房 read more
  • Zero

    Debug:
    flutter run --debug

    Release:
    flutter run --release --no-track-widget-creation

    posted in GuaiK实验室 read more
  • Zero

    启动容器命令:docker start d21a

    报错

    Error response from daemon: devmapper: Error mounting '/dev/mapper/docker-253:3-537354454-cdb4e31a34f55981f2cabe775700719ecc20bfdc6b85c1b26245b41026daa8fe' on '/var/lib/docker/devicemapper/mnt/cdb4e31a34f55981f2cabe775700719ecc20bfdc6b85c1b26245b41026daa8fe': invalid argument
    

    解决方式:
    /var/lib/docker/containers/d21a*目录中找到config.v2.json,然后vi config.v2.json
    找到MountLabelProcessLabel个键,并把其对应的引号中的内容清空即可

    posted in GuaiK机房 read more
  • Zero

    一、安装及测试

    1、安装

    useradd -s /sbin/nologin -d /opt/minio minio
    mkdir -p /opt/minio/bin
    mkdir /opt/minio/data
    wget https://dl.minio.io/server/minio/release/linux-amd64/minio -O /opt/minio/bin/minio
    chmod +x /opt/minio/bin/minio
    chown -R minio:minio /opt/minio
    

    2、添加配置文件

    vi /opt/minio/minio.conf

    MINIO_VOLUMES=/opt/minio/data
    MINIO_OPTS="--address :9090"
    MINIO_ACCESS_KEY=[YOUR_ACCESS_KEY]
    MINIO_SECRET_KEY=[YOUR_SECRET_KEY]
    

    3、添加系统服务

    vi /etc/systemd/system/minio.service

    [Unit]
    Description=Minio
    Documentation=https://docs.minio.io
    Wants=network-online.target
    After=network-online.target
    AssertFileIsExecutable=/opt/minio/bin/minio
    
    [Service]
    WorkingDirectory=/opt/minio
    
    User=minio
    Group=minio
    
    PermissionsStartOnly=true
    
    EnvironmentFile=-/opt/minio/minio.conf
    ExecStartPre=/bin/bash -c "[ -n \"${MINIO_VOLUMES}\" ] || echo \"Variable MINIO_VOLUMES not set in /opt/minio/minio.conf\""
    
    ExecStart=/opt/minio/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
    
    StandardOutput=journal
    StandardError=inherit
    
    # Specifies the maximum file descriptor number that can be opened by this process
    LimitNOFILE=65536
    
    # Disable timeout logic and wait until process is stopped
    TimeoutStopSec=0
    
    # SIGTERM signal is used to stop Minio
    KillSignal=SIGTERM
    
    SendSIGKILL=no
    
    SuccessExitStatus=0
    
    [Install]
    WantedBy=multi-user.target
    

    4、启动Minio服务

    systemctl enable minio
    systemctl start minio
    systemctl status minio
    

    PS:默认minio的监听端口是:9000,我在配置文件中改成了9090,所以可以通过:
    http://host:9090访问minio后台。

    posted in GuaiK机房 read more
  • Zero

    如果是Key-Vlue类型的数据(dict,map)相关的,你默认它遍历的顺序是随机的就好啦,它们本身就是无序的;有序的话主要还是List。

    posted in GuaiK故障处理 read more