Save
Saving
  • guluting

    刚入门Golang语言的新手而言,gopath简直是一个奇葩的存在,因为你有两个做法可以去创建一个Go的项目:

    第一种:你随便找个目录建立一个工程,然后需要在环境变量中配置gopath的路径。
    第二种:直接把工程建立在现有的gopath的目录下。
    这几种方式确实有点恶心到我了。


    BUT

    我在看开源项目的时候发现了一个好东西,我分析了项目根目录有一个叫"go.mod"的文件,你那么这是干嘛的呢,通过强大的Google搜索了一下,那么下面就记录一下结果吧,废话很少,很精简,自己测试即可:

    生成go.mod的方式:(假设项目根目录叫:“guaik”)

    cd ./guaik
    go mod init guaik
    

    最后的"guaik"名字可以随便更换,这时候目录下就会出现一个go.mod的文件,那么其实这样就完事了。很简单

    之后如果要引用当前项目的包(在guaik目录中年有一个http的包)可以使用以下方式:

    import (
    "guaik/http"
    )
    

    posted in GuaiK实验室 read more
  • guluting

    1、进入flutter的services目录
    cd flutter/packages/flutter/lib/src/services


    2、修改text_input.dart文件的TextInputConnection类的show方法,将以下代码注释掉
    SystemChannels.textInput.invokeMethod<void>('TextInput.show');

      /// Requests that the text input control become visible.
      void show() {
        assert(attached);
        // SystemChannels.textInput.invokeMethod<void>('TextInput.show');
      }
    

    3、重新编译下工程即可

    posted in GuaiK实验室 read more
  • guluting

    • Close Xcode
    • Open Keychain
    • Remove “Iphone Developer” and “Apple Worldwide Developer Relations Certification Authority”
    • Reopen Xcode
    • Product / Run the project again with debug executable checked (Succeed)
    • Close Xcode
    • Open vscode
    • Debug / Start debugging
    • It built and run on physical device successfully

    posted in GuaiK实验室 read more
  • guluting

    sudo vi /etc/bashrc

    #PS1='\h:\W \u\$ '
    PS1='\W \$ '
    

    posted in GuaiK实验室 read more
  • guluting

        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
  • guluting

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


    依赖库安装:(Mac OS)

    brew install fftw
    brew install libsndfile
    

    编译:

    make --makefile=Makefile.waon
    

    posted in GuaiK实验室 read more
  • guluting

    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
  • guluting

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

    posted in GuaiK实验室 read more
  • guluting

    使用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
  • guluting

    Debug:
    flutter run --debug

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

    posted in GuaiK实验室 read more