TortoiseSVN客户端重新设置用户名和密码

在第一次使用TortoiseSVN从服务器CheckOut的时候,会要求输入用户名和密码,这时输入框下面有个选项是保存认证信息,如果选了这个选项,那么以后就不用每次都输入一遍用户名密码了。
不过,如果后来在服务器端修改了用户名密码,则再次检出时就会出错,而且这个客户端很弱智,出错之后不会自动跳出用户名密码输入框让人更新,我找了半天也没找到修改这个用户名密码的地方。
最终,找到两种解决办法:
办法一:在TortoiseSVN的设置对话框中,选择“已保存数据”,在“认证数据”那一行点击“清除”按钮,清楚保存的认证数据,再检出的时候就会重新跳出用户名密码输入框。2012032209211811
如果方法一不起作用,则可以采用方法二:
Tortoise的用户名密码等认证信息都是缓存在客户端文件系统的这个目录:

删除auth下面的所有文件夹,重新连接远程服务器进行检出,对话框就会出现!

参考链接 TortoiseSVN客户端重新设置用户名和密码

Linux下查看so导出函数列表

1.只查看导出函数

2.查看更详细的二进制信息

注意使用readelf读取函数列表的时候,如果函数名比较长,可能会在显示的时候被截断,如果只查看导出函数,建议使用 objdump命令。

3.查看链接的库

objdump,readelf,nm,ldd命令不能在Cygwin中使用

最近在Windows下面编写NDK应用,在检查编译完成后的so文件的时候,发现,objdump,readelf,nm,ldd等命令不能在默认安装的Cygwin中使用。解决方法是,下载Cygwin的安装包,然后点击安装,从选择包里面增加 binutils包,如下图所示:(注意,只选择Devel版本即可,正常情况下我们一般不会需要携带调试信息的版本cygwin_binutils

Windows下使用命令行执行需要用SSH keys登录的Git

Windows下使用Git的时候,大家都习惯了使用TortoiseGit来执行操作。但是在某些情况下,必须在Git Bash下面执行命令的时候,就比较麻烦了,尤其是服务器设置了SSH keys登陆的时候。默认情况下,TortoiseGit会自动加载puttygen生成的.PPK文件来完成认证工作,但是在Git Bash 下面,只能是根据Linux下面的配置来进行登陆认证了。

1.在Git Bash中输入“puttygen”,如下图所示:puttygen
弹出如下图形界面:putty_key_generator
对于已经有PPK文件的情况,点击"Load"来加载,没有PPK文件,请点击"Generate"来生成。加载完成后,点击菜单上的“Conversions”按钮,如下图所示:export_openssh_key

导出的文件没有扩展名,命名为“id_rsa”,注意,必须是这个名字,没有扩展名。

2.拷贝文件“id_rsa”到当前用户目录下面的 “.ssh”目录下面,当前用户目录的位置,请在Git Bash中输入“echo ~”来显示出来,最后的结果如下图所示id_rsa

3.在Git Bash中继续执行命令,就可以了!

将已有的Git项目的某个目录分离成独立子模块

当一个项目在开发若干时间后,希望将某个目录单独出一个项目来开发,此时就可以利用这个subtree的功能分离里。

具体的操作方式是这样的:(只能在Git Bash的命令行中操作
1. 首先cd到需要处理的项目的根目录

注意
<name-of-folder> 必须是从工程的根目录开始算起,类似“project/hello/world”的格式。
<name-of-new-branch> 的名字,尽量取简单。

2. 创建一个新的repo(项目)(离开原有的项目的文件夹,在另外的地方新建一个项目

注意
</path/to/big-repo>是我们需要拉取数据的根目录的绝对路径,类似 “D:\Source\Project”的格式。
<name-of-new-branch> 是我们刚刚分离出来的分支的名字。

3. 添加子模块(到原来工程的根目录下面

可以看到,在原来的Git工程的根目录下面增加了一个名为“.gitmodules”的文件,里面的内容如下:

fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

最近在使用 VS2015 编译以前用VS2008的项目的时候,提示错误:fatal error C1189: #error :  The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

解决方法:在项目的“预处理器定义”中增加 "_XKEYCHECK_H"

Linux计算MD5和Sha1的命令

MD5

MD5即Message-Digest Algorithm 5(信息-摘要算法 5),用于确保信息传输完整一致。是计算机广泛使用的杂凑算法之一(又译摘要算法、哈希算法),主流编程语言普遍已有MD5实现。

Sha1

安全散列算法(英语:Secure Hash Algorithm)是一种能计算出一个数位讯息所对应到的,长度固定的字串(又称讯息摘要)的算法。且若输入的讯息不同,它们对应到不同字串的机率很高;而SHA是FIPS所认证的五种安全散列算法。这些算法之所以称作“安全”是基于以下两点(根据官方标准的描述):“1)由讯息摘要反推原输入讯息,从计算理论上来说是很困难的。2)想要找到两组不同的讯息对应到相同的讯息摘要,从计算理论上来说也是很困难的。任何对输入讯息的变动,都有很高的机率导致其产生的讯息摘要迥异。

MD5 与 SHA1 是当前最常用的两种哈希算法。那在Linux下如何计算这两种哈希值呢,基本上所有的 Linux 发行版都内置了这两个命令,比如要校检的文件命为OurUnix.tar:

计算文件的 MD5 – md5sum

计算文件的 SHA1 – sha1sum

引用 Linux计算MD5和Sha1的命令

Android Studio 1.3 配置编译NDK参考文档

Experimental Plugin User Guide

Introduction

The new experimental plugin is based on Gradle’s new component model mechanism, while allows significant reduction in configuration time. It also includes NDK integration for building JNI applications. This user guides provides details on how to use it and highlights the difference between the new plugin and the original plugin.

WARNING: Note that this is plugin is at the experimental stage. The Gradle API for the new component model is not final, which means it’ll only work with a specific version of Gradle until the APIs are final.

Additionally, the DSL is likely change significantly, as APIs to create the DSL are finalized.

This is a very early preview of the plugin for feedback on performance and NDK integration.

Requirements

  • Gradle 2.5 only
  • Android NDK r10e (if you are using NDK)
  • SDK with Build Tools at least version 19.0.0 and we aim to minimize the amount of changes needed for the migration process in the future. Some features may require a more recent version.

Migrating from Traditional Android Gradle Plugin

A typical Android Studio project may have a directory structure as follows. File that needs to be change is highlighted in red:
There are some significant changes in the DSL between the new plugin and the traditional one.

.

├── app/

│   ├── app.iml

│   ├── build.gradle

│   └── src/

├── build.gradle

├── gradle/

│   └── wrapper/

│       ├── gradle-wrapper.jar

│       └── gradle-wrapper.properties

├── gradle.properties

├── gradlew*

├── gradlew.bat

├── local.properties

├── MyApplication.iml

└── settings.gradle

 

./gradle/wrapper/gradle-wrapper.properties

  • The new plugin supports only gradle-2.5.

#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip

./build.gradle

  • Classpath for the plugin is com.android.tools.build:gradle-experimental instead of com.android.tools.build:gradle.

  • The current version is 0.2.0.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

      repositories {

            jcenter()

      }

      dependencies {

            classpath 'com.android.tools.build:gradle-experimental:0.2.0'

          // NOTE: Do not place your application dependencies here

        // in the individual module build.gradle files

      }

}

allprojects {

      repositories {

            jcenter()

      }

}

 

./app/build.gradle

There are significant changes to the DSL of the plugin.  We understand that many of the changes are frustrating and seem unnecessary, and our goal is to remove some of these current changes to minimize the migration process from the traditional plugin in the future.

DSL Changes:

  • Plugin name is com.android.model.application instead of com.android.application. Or use apply plugin: 'com.android.model.library' if you want to create an Android aar library.

  • Configuration is wrapped with the model { } block

  • Most properties require the = operator

  • Adding elements to a Collection should be done using the += operator.

Current DSL Limitations that will hopefully go away:

  • buildTypes, productFlavors and signingConfigs must be place outside of the  android { } block.

  • Nested options within the android { } block must be configured using the with keyword.

  • Properties are only set with their direct types only, with no way to accept other types and adapting them. For instance:

    • Properties of type File accepts only File instead of File and String objects.

    • minSdkVersion cannot directly receive either an integer or string (for codename).

  • Creating a buildType or productFlavor requires calling the create method.  Modifying an existing one such as the release and debug buildType can be done using the just the name.

  • The DSL for modifying variants and their tasks is very, very limited right now.

apply plugin: 'com.android.model.application'

model {

      android {

           compileSdkVersion = 22

           buildToolsVersion = "22.0.1"

           defaultConfig.with {

                applicationId =  "com.example.user.myapplication"

                minSdkVersion.apiLevel = 15

                targetSdkVersion.apiLevel = 22

                versionCode = 1

                versionName = "1.0"

                buildConfigFields.with {

                     create() {

                     type = "int"

                     name = "VALUE"

                     value = "1"

                     }

                }

           }

      }

      android.buildTypes {

           release {

                minifyEnabled = false

                proguardFiles += file('proguard-rules.pro')

           }

      }

      android.productFlavors {

           create("flavor1") {

                applicationId = ‘com.app’

           }

      }

      // Configures source set directory.

      android.sources {

           main {

                java {

                     source {

                          srcDir 'src'

                     }

                }

           }

      }

}

dependencies {

      compile fileTree(dir: 'libs', include: ['*.jar'])

      compile 'com.android.support:appcompat-v7:22.2.0'

}

 

Ndk Integration

The experimental plugin comes with NDK integration for creating native applications.  To use the NDK integration:

  • Use the SDK Manager inside Studio to download the NDK.

  • Set ndk.dir in local.properties or the ANDROID_NDK_HOME environment variable to the directory containing the NDK.

  • Add an android.ndk block to the model in build.gradle.

Known Limitations

  • There’s no support for NDK-only modules. The only supported project types are hybrid app projects and hybrid Library Projects.
  • Consumed Library project don’t impact compilation of jni code in the consuming project (ie the AAR so files are simply packaged in the APK)
  • No support for creating and depending on static libraries
  • No support for using a NDK modules like cpu_features
  • No support for integrating external build systems.

The build.gradle of a simple NDK application may look like this:

*Note that the moduleName is required.  It determines the name of the resulting native library.

By default, it will look in src/main/jni for C/C++ file.  Configure android.sources to change the source directory.

Various build options can be set within the android.ndk { } block.  For example,

Samples

Additional samples can be found at https://github.com/googlesamples/android-ndk.
对于不能正常访问GitHub的,可以点击这里下载最近保存的版本。

Android Studio 1.3.2 NDK编译报错 'com.android.build.gradle.managed.ProductFlavor_Impl'

Android Studio 1.3.2已经支持NDK的编译,调试。但是已经跟老的项目通过配置 Application.mk,Android.mk来编译NDK的形式完全不同了。参考编译配置文档,采用了Gradle 2.5的配置方式(详细配置参考 Android Studio 1.3 配置编译NDK参考文档,Google官方链接),结果在编译报错,显示如下信息:

Error:Unable to load class 'com.android.build.gradle.managed.ProductFlavor_Impl'.
Possible causes for this unexpected error include:

  • You are using JDK version 'java version "1.7.0_80"'. Some versions of JDK 1.7 (e.g. 1.7.0_10) may cause class loading errors in Gradle.
    Please update to a newer version (e.g. 1.7.0_67).
    Open JDK Settings
  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
    Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
    Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

查找了好长时间原因,最后发现,是由于build.gradle中修改有问题。
先看看有问题的build.gradle,注意defaultConfig.with部分的差别

修改后的为(注意defaultConfig.with部分的差别

一个疏忽,浪费时间很多啊!